id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
101,500
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.findReplacements
public ArrayList<String> findReplacements(String word) { final List<CandidateData> result = findReplacementCandidates(word); final ArrayList<String> resultSuggestions = new ArrayList<String>(result.size()); for (CandidateData cd : result) { resultSuggestions.add(cd.getWord()); } return...
java
public ArrayList<String> findReplacements(String word) { final List<CandidateData> result = findReplacementCandidates(word); final ArrayList<String> resultSuggestions = new ArrayList<String>(result.size()); for (CandidateData cd : result) { resultSuggestions.add(cd.getWord()); } return...
[ "public", "ArrayList", "<", "String", ">", "findReplacements", "(", "String", "word", ")", "{", "final", "List", "<", "CandidateData", ">", "result", "=", "findReplacementCandidates", "(", "word", ")", ";", "final", "ArrayList", "<", "String", ">", "resultSugg...
Find suggestions by using K. Oflazer's algorithm. See Jan Daciuk's s_fsa package, spell.cc for further explanation. @param word The original misspelled word. @return A list of suggested replacements.
[ "Find", "suggestions", "by", "using", "K", ".", "Oflazer", "s", "algorithm", ".", "See", "Jan", "Daciuk", "s", "s_fsa", "package", "spell", ".", "cc", "for", "further", "explanation", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L356-L364
101,501
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.ed
public int ed(final int i, final int j, final int wordIndex, final int candIndex) { int result; int a, b, c; if (areEqual(wordProcessed[wordIndex], candidate[candIndex])) { // last characters are the same result = hMatrix.get(i, j); } else if (wordIndex > 0 && candIndex > 0 && wordPr...
java
public int ed(final int i, final int j, final int wordIndex, final int candIndex) { int result; int a, b, c; if (areEqual(wordProcessed[wordIndex], candidate[candIndex])) { // last characters are the same result = hMatrix.get(i, j); } else if (wordIndex > 0 && candIndex > 0 && wordPr...
[ "public", "int", "ed", "(", "final", "int", "i", ",", "final", "int", "j", ",", "final", "int", "wordIndex", ",", "final", "int", "candIndex", ")", "{", "int", "result", ";", "int", "a", ",", "b", ",", "c", ";", "if", "(", "areEqual", "(", "wordP...
Calculates edit distance. @param i length of first word (here: misspelled) - 1; @param j length of second word (here: candidate) - 1. @param wordIndex (TODO: javadoc?) @param candIndex (TODO: javadoc?) @return Edit distance between the two words. Remarks: See Oflazer.
[ "Calculates", "edit", "distance", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L558-L582
101,502
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.areEqual
private boolean areEqual(final char x, final char y) { if (x == y) { return true; } if (dictionaryMetadata.getEquivalentChars() != null) { List<Character> chars = dictionaryMetadata.getEquivalentChars().get(x); if (chars != null && chars.contains(y)) { return true; } ...
java
private boolean areEqual(final char x, final char y) { if (x == y) { return true; } if (dictionaryMetadata.getEquivalentChars() != null) { List<Character> chars = dictionaryMetadata.getEquivalentChars().get(x); if (chars != null && chars.contains(y)) { return true; } ...
[ "private", "boolean", "areEqual", "(", "final", "char", "x", ",", "final", "char", "y", ")", "{", "if", "(", "x", "==", "y", ")", "{", "return", "true", ";", "}", "if", "(", "dictionaryMetadata", ".", "getEquivalentChars", "(", ")", "!=", "null", ")"...
by Jaume Ortola
[ "by", "Jaume", "Ortola" ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L585-L615
101,503
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.cuted
public int cuted(final int depth, final int wordIndex, final int candIndex) { final int l = Math.max(0, depth - effectEditDistance); // min chars from word to consider - 1 final int u = Math.min(wordLen - 1 - (wordIndex - depth), depth + effectEditDistance); // max chars from word to // consider - 1 ...
java
public int cuted(final int depth, final int wordIndex, final int candIndex) { final int l = Math.max(0, depth - effectEditDistance); // min chars from word to consider - 1 final int u = Math.min(wordLen - 1 - (wordIndex - depth), depth + effectEditDistance); // max chars from word to // consider - 1 ...
[ "public", "int", "cuted", "(", "final", "int", "depth", ",", "final", "int", "wordIndex", ",", "final", "int", "candIndex", ")", "{", "final", "int", "l", "=", "Math", ".", "max", "(", "0", ",", "depth", "-", "effectEditDistance", ")", ";", "// min cha...
Calculates cut-off edit distance. @param depth current length of candidates. @param wordIndex (TODO: javadoc?) @param candIndex (TODO: javadoc?) @return Cut-off edit distance. Remarks: See Oflazer.
[ "Calculates", "cut", "-", "off", "edit", "distance", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L626-L640
101,504
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.matchAnyToOne
private int matchAnyToOne(final int wordIndex, final int candIndex) { if (replacementsAnyToOne.containsKey(candidate[candIndex])) { for (final char[] rep : replacementsAnyToOne.get(candidate[candIndex])) { int i = 0; while (i < rep.length && (wordIndex + i) < wordLen && rep[i] == wordProce...
java
private int matchAnyToOne(final int wordIndex, final int candIndex) { if (replacementsAnyToOne.containsKey(candidate[candIndex])) { for (final char[] rep : replacementsAnyToOne.get(candidate[candIndex])) { int i = 0; while (i < rep.length && (wordIndex + i) < wordLen && rep[i] == wordProce...
[ "private", "int", "matchAnyToOne", "(", "final", "int", "wordIndex", ",", "final", "int", "candIndex", ")", "{", "if", "(", "replacementsAnyToOne", ".", "containsKey", "(", "candidate", "[", "candIndex", "]", ")", ")", "{", "for", "(", "final", "char", "["...
Match the last letter of the candidate against two or more letters of the word.
[ "Match", "the", "last", "letter", "of", "the", "candidate", "against", "two", "or", "more", "letters", "of", "the", "word", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L643-L656
101,505
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.containsNoDigit
static boolean containsNoDigit(final String s) { for (int k = 0; k < s.length(); k++) { if (Character.isDigit(s.charAt(k))) { return false; } } return true; }
java
static boolean containsNoDigit(final String s) { for (int k = 0; k < s.length(); k++) { if (Character.isDigit(s.charAt(k))) { return false; } } return true; }
[ "static", "boolean", "containsNoDigit", "(", "final", "String", "s", ")", "{", "for", "(", "int", "k", "=", "0", ";", "k", "<", "s", ".", "length", "(", ")", ";", "k", "++", ")", "{", "if", "(", "Character", ".", "isDigit", "(", "s", ".", "char...
Checks whether a string contains a digit. Used for ignoring words with numbers @param s Word to be checked. @return True if there is a digit inside the word.
[ "Checks", "whether", "a", "string", "contains", "a", "digit", ".", "Used", "for", "ignoring", "words", "with", "numbers" ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L706-L713
101,506
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/Speller.java
Speller.setWordAndCandidate
void setWordAndCandidate(final String word, final String candidate) { wordProcessed = word.toCharArray(); wordLen = wordProcessed.length; this.candidate = candidate.toCharArray(); candLen = this.candidate.length; effectEditDistance = wordLen <= editDistance ? wordLen - 1 : editDistance; }
java
void setWordAndCandidate(final String word, final String candidate) { wordProcessed = word.toCharArray(); wordLen = wordProcessed.length; this.candidate = candidate.toCharArray(); candLen = this.candidate.length; effectEditDistance = wordLen <= editDistance ? wordLen - 1 : editDistance; }
[ "void", "setWordAndCandidate", "(", "final", "String", "word", ",", "final", "String", "candidate", ")", "{", "wordProcessed", "=", "word", ".", "toCharArray", "(", ")", ";", "wordLen", "=", "wordProcessed", ".", "length", ";", "this", ".", "candidate", "=",...
Sets up the word and candidate. Used only to test the edit distance in JUnit tests. @param word the first word @param candidate the second word used for edit distance calculation
[ "Sets", "up", "the", "word", "and", "candidate", ".", "Used", "only", "to", "test", "the", "edit", "distance", "in", "JUnit", "tests", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L871-L877
101,507
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/BufferUtils.java
BufferUtils.sharedPrefixLength
static int sharedPrefixLength(ByteBuffer a, int aStart, ByteBuffer b, int bStart) { int i = 0; final int max = Math.min(a.remaining() - aStart, b.remaining() - bStart); aStart += a.position(); bStart += b.position(); while (i < max && a.get(aStart++) == b.get(bStart++)) { i++; } ...
java
static int sharedPrefixLength(ByteBuffer a, int aStart, ByteBuffer b, int bStart) { int i = 0; final int max = Math.min(a.remaining() - aStart, b.remaining() - bStart); aStart += a.position(); bStart += b.position(); while (i < max && a.get(aStart++) == b.get(bStart++)) { i++; } ...
[ "static", "int", "sharedPrefixLength", "(", "ByteBuffer", "a", ",", "int", "aStart", ",", "ByteBuffer", "b", ",", "int", "bStart", ")", "{", "int", "i", "=", "0", ";", "final", "int", "max", "=", "Math", ".", "min", "(", "a", ".", "remaining", "(", ...
Compute the length of the shared prefix between two byte sequences.
[ "Compute", "the", "length", "of", "the", "shared", "prefix", "between", "two", "byte", "sequences", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/BufferUtils.java#L99-L108
101,508
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/BufferUtils.java
BufferUtils.charsToBytes
public static ByteBuffer charsToBytes(CharsetEncoder encoder, CharBuffer chars, ByteBuffer bytes) throws UnmappableInputException { assert encoder.malformedInputAction() == CodingErrorAction.REPORT; bytes = clearAndEnsureCapacity(bytes, (int) (chars.remaining() * encoder.maxBytesPerChar())); ...
java
public static ByteBuffer charsToBytes(CharsetEncoder encoder, CharBuffer chars, ByteBuffer bytes) throws UnmappableInputException { assert encoder.malformedInputAction() == CodingErrorAction.REPORT; bytes = clearAndEnsureCapacity(bytes, (int) (chars.remaining() * encoder.maxBytesPerChar())); ...
[ "public", "static", "ByteBuffer", "charsToBytes", "(", "CharsetEncoder", "encoder", ",", "CharBuffer", "chars", ",", "ByteBuffer", "bytes", ")", "throws", "UnmappableInputException", "{", "assert", "encoder", ".", "malformedInputAction", "(", ")", "==", "CodingErrorAc...
Convert chars into bytes.
[ "Convert", "chars", "into", "bytes", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/BufferUtils.java#L152-L180
101,509
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.add
public void add(byte[] sequence, int start, int len) { assert serialized != null : "Automaton already built."; assert previous == null || len == 0 || compare(previous, 0, previousLength, sequence, start, len) <= 0 : "Input must be sorted: " + Arrays.toString(Arrays.copyOf(previous, previousLength)) ...
java
public void add(byte[] sequence, int start, int len) { assert serialized != null : "Automaton already built."; assert previous == null || len == 0 || compare(previous, 0, previousLength, sequence, start, len) <= 0 : "Input must be sorted: " + Arrays.toString(Arrays.copyOf(previous, previousLength)) ...
[ "public", "void", "add", "(", "byte", "[", "]", "sequence", ",", "int", "start", ",", "int", "len", ")", "{", "assert", "serialized", "!=", "null", ":", "\"Automaton already built.\"", ";", "assert", "previous", "==", "null", "||", "len", "==", "0", "||"...
Add a single sequence of bytes to the FSA. The input must be lexicographically greater than any previously added sequence. @param sequence The array holding input sequence of bytes. @param start Starting offset (inclusive) @param len Length of the input sequence (at least 1 byte).
[ "Add", "a", "single", "sequence", "of", "bytes", "to", "the", "FSA", ".", "The", "input", "must", "be", "lexicographically", "greater", "than", "any", "previously", "added", "sequence", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L166-L200
101,510
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.build
public static FSA build(byte[][] input) { final FSABuilder builder = new FSABuilder(); for (byte[] chs : input) { builder.add(chs, 0, chs.length); } return builder.complete(); }
java
public static FSA build(byte[][] input) { final FSABuilder builder = new FSABuilder(); for (byte[] chs : input) { builder.add(chs, 0, chs.length); } return builder.complete(); }
[ "public", "static", "FSA", "build", "(", "byte", "[", "]", "[", "]", "input", ")", "{", "final", "FSABuilder", "builder", "=", "new", "FSABuilder", "(", ")", ";", "for", "(", "byte", "[", "]", "chs", ":", "input", ")", "{", "builder", ".", "add", ...
Build a minimal, deterministic automaton from a sorted list of byte sequences. @param input Input sequences to build automaton from. @return Returns the automaton encoding all input sequences.
[ "Build", "a", "minimal", "deterministic", "automaton", "from", "a", "sorted", "list", "of", "byte", "sequences", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L243-L251
101,511
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.getArcTarget
private int getArcTarget(int arc) { arc += ADDRESS_OFFSET; return (serialized[arc] ) << 24 | (serialized[arc + 1] & 0xff) << 16 | (serialized[arc + 2] & 0xff) << 8 | (serialized[arc + 3] & 0xff); }
java
private int getArcTarget(int arc) { arc += ADDRESS_OFFSET; return (serialized[arc] ) << 24 | (serialized[arc + 1] & 0xff) << 16 | (serialized[arc + 2] & 0xff) << 8 | (serialized[arc + 3] & 0xff); }
[ "private", "int", "getArcTarget", "(", "int", "arc", ")", "{", "arc", "+=", "ADDRESS_OFFSET", ";", "return", "(", "serialized", "[", "arc", "]", ")", "<<", "24", "|", "(", "serialized", "[", "arc", "+", "1", "]", "&", "0xff", ")", "<<", "16", "|", ...
Returns the address of an arc.
[ "Returns", "the", "address", "of", "an", "arc", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L307-L313
101,512
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.expandAndRehash
private void expandAndRehash() { final int[] newHashSet = new int[hashSet.length * 2]; final int bucketMask = (newHashSet.length - 1); for (int j = 0; j < hashSet.length; j++) { final int state = hashSet[j]; if (state > 0) { int slot = hash(state, stateLength(state)) & bucketMask; ...
java
private void expandAndRehash() { final int[] newHashSet = new int[hashSet.length * 2]; final int bucketMask = (newHashSet.length - 1); for (int j = 0; j < hashSet.length; j++) { final int state = hashSet[j]; if (state > 0) { int slot = hash(state, stateLength(state)) & bucketMask; ...
[ "private", "void", "expandAndRehash", "(", ")", "{", "final", "int", "[", "]", "newHashSet", "=", "new", "int", "[", "hashSet", ".", "length", "*", "2", "]", ";", "final", "int", "bucketMask", "=", "(", "newHashSet", ".", "length", "-", "1", ")", ";"...
Reallocate and rehash the hash set.
[ "Reallocate", "and", "rehash", "the", "hash", "set", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L366-L381
101,513
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.serialize
private int serialize(final int activePathIndex) { expandBuffers(); final int newState = size; final int start = activePath[activePathIndex]; final int len = nextArcOffset[activePathIndex] - start; System.arraycopy(serialized, start, serialized, newState, len); size += len; return newState...
java
private int serialize(final int activePathIndex) { expandBuffers(); final int newState = size; final int start = activePath[activePathIndex]; final int len = nextArcOffset[activePathIndex] - start; System.arraycopy(serialized, start, serialized, newState, len); size += len; return newState...
[ "private", "int", "serialize", "(", "final", "int", "activePathIndex", ")", "{", "expandBuffers", "(", ")", ";", "final", "int", "newState", "=", "size", ";", "final", "int", "start", "=", "activePath", "[", "activePathIndex", "]", ";", "final", "int", "le...
Serialize a given state on the active path.
[ "Serialize", "a", "given", "state", "on", "the", "active", "path", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L412-L422
101,514
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.expandActivePath
private void expandActivePath(int size) { if (activePath.length < size) { final int p = activePath.length; activePath = java.util.Arrays.copyOf(activePath, size); nextArcOffset = java.util.Arrays.copyOf(nextArcOffset, size); for (int i = p; i < size; i++) { nextArcOffset[i] = active...
java
private void expandActivePath(int size) { if (activePath.length < size) { final int p = activePath.length; activePath = java.util.Arrays.copyOf(activePath, size); nextArcOffset = java.util.Arrays.copyOf(nextArcOffset, size); for (int i = p; i < size; i++) { nextArcOffset[i] = active...
[ "private", "void", "expandActivePath", "(", "int", "size", ")", "{", "if", "(", "activePath", ".", "length", "<", "size", ")", "{", "final", "int", "p", "=", "activePath", ".", "length", ";", "activePath", "=", "java", ".", "util", ".", "Arrays", ".", ...
Append a new mutable state to the active path.
[ "Append", "a", "new", "mutable", "state", "to", "the", "active", "path", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L444-L454
101,515
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.expandBuffers
private void expandBuffers() { if (this.serialized.length < size + ARC_SIZE * MAX_LABELS) { serialized = java.util.Arrays.copyOf(serialized, serialized.length + bufferGrowthSize); serializationBufferReallocations++; } }
java
private void expandBuffers() { if (this.serialized.length < size + ARC_SIZE * MAX_LABELS) { serialized = java.util.Arrays.copyOf(serialized, serialized.length + bufferGrowthSize); serializationBufferReallocations++; } }
[ "private", "void", "expandBuffers", "(", ")", "{", "if", "(", "this", ".", "serialized", ".", "length", "<", "size", "+", "ARC_SIZE", "*", "MAX_LABELS", ")", "{", "serialized", "=", "java", ".", "util", ".", "Arrays", ".", "copyOf", "(", "serialized", ...
Expand internal buffers for the next state.
[ "Expand", "internal", "buffers", "for", "the", "next", "state", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L459-L464
101,516
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/DictionaryLookup.java
DictionaryLookup.applyReplacements
public static String applyReplacements(CharSequence word, LinkedHashMap<String, String> replacements) { // quite horrible from performance point of view; this should really be a transducer. StringBuilder sb = new StringBuilder(word); for (final Map.Entry<String, String> e : replacements.entrySet()) { ...
java
public static String applyReplacements(CharSequence word, LinkedHashMap<String, String> replacements) { // quite horrible from performance point of view; this should really be a transducer. StringBuilder sb = new StringBuilder(word); for (final Map.Entry<String, String> e : replacements.entrySet()) { ...
[ "public", "static", "String", "applyReplacements", "(", "CharSequence", "word", ",", "LinkedHashMap", "<", "String", ",", "String", ">", "replacements", ")", "{", "// quite horrible from performance point of view; this should really be a transducer.\r", "StringBuilder", "sb", ...
Apply partial string replacements from a given map. Useful if the word needs to be normalized somehow (i.e., ligatures, apostrophes and such). @param word The word to apply replacements to. @param replacements A map of replacements (from-&gt;to). @return new string with all replacements applied.
[ "Apply", "partial", "string", "replacements", "from", "a", "given", "map", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/DictionaryLookup.java#L259-L271
101,517
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java
CFSA2Serializer.computeLabelsIndex
private void computeLabelsIndex(final FSA fsa) { // Compute labels count. final int[] countByValue = new int[256]; fsa.visitAllStates(new StateVisitor() { public boolean accept(int state) { for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.getNextArc(arc)) countByVal...
java
private void computeLabelsIndex(final FSA fsa) { // Compute labels count. final int[] countByValue = new int[256]; fsa.visitAllStates(new StateVisitor() { public boolean accept(int state) { for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.getNextArc(arc)) countByVal...
[ "private", "void", "computeLabelsIndex", "(", "final", "FSA", "fsa", ")", "{", "// Compute labels count.\r", "final", "int", "[", "]", "countByValue", "=", "new", "int", "[", "256", "]", ";", "fsa", ".", "visitAllStates", "(", "new", "StateVisitor", "(", ")"...
Compute a set of labels to be integrated with the flags field.
[ "Compute", "a", "set", "of", "labels", "to", "be", "integrated", "with", "the", "flags", "field", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L158-L196
101,518
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java
CFSA2Serializer.linearizeState
private void linearizeState(final FSA fsa, IntStack nodes, IntArrayList linearized, BitSet visited, int node) { linearized.add(node); visited.set(node); for (int arc = fsa.getFirstArc(node); arc != 0; arc = fsa.getNextArc(arc)) { if (!fsa.isArcTerminal(arc)) { final int target = fsa.getEn...
java
private void linearizeState(final FSA fsa, IntStack nodes, IntArrayList linearized, BitSet visited, int node) { linearized.add(node); visited.set(node); for (int arc = fsa.getFirstArc(node); arc != 0; arc = fsa.getNextArc(arc)) { if (!fsa.isArcTerminal(arc)) { final int target = fsa.getEn...
[ "private", "void", "linearizeState", "(", "final", "FSA", "fsa", ",", "IntStack", "nodes", ",", "IntArrayList", "linearized", ",", "BitSet", "visited", ",", "int", "node", ")", "{", "linearized", ".", "add", "(", "node", ")", ";", "visited", ".", "set", ...
Add a state to linearized list.
[ "Add", "a", "state", "to", "linearized", "list", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L319-L329
101,519
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java
CFSA2Serializer.computeFirstStates
private int[] computeFirstStates(IntIntHashMap inlinkCount, int maxStates, int minInlinkCount) { Comparator<IntIntHolder> comparator = new Comparator<FSAUtils.IntIntHolder>() { public int compare(IntIntHolder o1, IntIntHolder o2) { int v = o1.a - o2.a; return v == 0 ? (o1.b - o2.b) : v; ...
java
private int[] computeFirstStates(IntIntHashMap inlinkCount, int maxStates, int minInlinkCount) { Comparator<IntIntHolder> comparator = new Comparator<FSAUtils.IntIntHolder>() { public int compare(IntIntHolder o1, IntIntHolder o2) { int v = o1.a - o2.a; return v == 0 ? (o1.b - o2.b) : v; ...
[ "private", "int", "[", "]", "computeFirstStates", "(", "IntIntHashMap", "inlinkCount", ",", "int", "maxStates", ",", "int", "minInlinkCount", ")", "{", "Comparator", "<", "IntIntHolder", ">", "comparator", "=", "new", "Comparator", "<", "FSAUtils", ".", "IntIntH...
Compute the set of states that should be linearized first to minimize other states goto length.
[ "Compute", "the", "set", "of", "states", "that", "should", "be", "linearized", "first", "to", "minimize", "other", "states", "goto", "length", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L335-L366
101,520
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java
CFSA2Serializer.computeInlinkCount
private IntIntHashMap computeInlinkCount(final FSA fsa) { IntIntHashMap inlinkCount = new IntIntHashMap(); BitSet visited = new BitSet(); IntStack nodes = new IntStack(); nodes.push(fsa.getRootNode()); while (!nodes.isEmpty()) { final int node = nodes.pop(); if (visited.get(node...
java
private IntIntHashMap computeInlinkCount(final FSA fsa) { IntIntHashMap inlinkCount = new IntIntHashMap(); BitSet visited = new BitSet(); IntStack nodes = new IntStack(); nodes.push(fsa.getRootNode()); while (!nodes.isEmpty()) { final int node = nodes.pop(); if (visited.get(node...
[ "private", "IntIntHashMap", "computeInlinkCount", "(", "final", "FSA", "fsa", ")", "{", "IntIntHashMap", "inlinkCount", "=", "new", "IntIntHashMap", "(", ")", ";", "BitSet", "visited", "=", "new", "BitSet", "(", ")", ";", "IntStack", "nodes", "=", "new", "In...
Compute in-link count for each state.
[ "Compute", "in", "-", "link", "count", "for", "each", "state", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L371-L395
101,521
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java
CFSA2Serializer.emitNodeArcs
private int emitNodeArcs(FSA fsa, OutputStream os, final int state, final int nextState) throws IOException { int offset = 0; for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.getNextArc(arc)) { int targetOffset; final int target; if (fsa.isArcTerminal(arc)) { target =...
java
private int emitNodeArcs(FSA fsa, OutputStream os, final int state, final int nextState) throws IOException { int offset = 0; for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.getNextArc(arc)) { int targetOffset; final int target; if (fsa.isArcTerminal(arc)) { target =...
[ "private", "int", "emitNodeArcs", "(", "FSA", "fsa", ",", "OutputStream", "os", ",", "final", "int", "state", ",", "final", "int", "nextState", ")", "throws", "IOException", "{", "int", "offset", "=", "0", ";", "for", "(", "int", "arc", "=", "fsa", "."...
Emit all arcs of a single node.
[ "Emit", "all", "arcs", "of", "a", "single", "node", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L433-L466
101,522
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java
CFSA2Serializer.writeVInt
static int writeVInt(byte[] array, int offset, int value) { assert value >= 0 : "Can't v-code negative ints."; while (value > 0x7F) { array[offset++] = (byte) (0x80 | (value & 0x7F)); value >>= 7; } array[offset++] = (byte) value; return offset; }
java
static int writeVInt(byte[] array, int offset, int value) { assert value >= 0 : "Can't v-code negative ints."; while (value > 0x7F) { array[offset++] = (byte) (0x80 | (value & 0x7F)); value >>= 7; } array[offset++] = (byte) value; return offset; }
[ "static", "int", "writeVInt", "(", "byte", "[", "]", "array", ",", "int", "offset", ",", "int", "value", ")", "{", "assert", "value", ">=", "0", ":", "\"Can't v-code negative ints.\"", ";", "while", "(", "value", ">", "0x7F", ")", "{", "array", "[", "o...
Write a v-int to a byte array.
[ "Write", "a", "v", "-", "int", "to", "a", "byte", "array", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L525-L535
101,523
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSAUtils.java
FSAUtils.rightLanguageForAllStates
public static IntIntHashMap rightLanguageForAllStates(final FSA fsa) { final IntIntHashMap numbers = new IntIntHashMap(); fsa.visitInPostOrder(new StateVisitor() { public boolean accept(int state) { int thisNodeNumber = 0; for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.g...
java
public static IntIntHashMap rightLanguageForAllStates(final FSA fsa) { final IntIntHashMap numbers = new IntIntHashMap(); fsa.visitInPostOrder(new StateVisitor() { public boolean accept(int state) { int thisNodeNumber = 0; for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.g...
[ "public", "static", "IntIntHashMap", "rightLanguageForAllStates", "(", "final", "FSA", "fsa", ")", "{", "final", "IntIntHashMap", "numbers", "=", "new", "IntIntHashMap", "(", ")", ";", "fsa", ".", "visitInPostOrder", "(", "new", "StateVisitor", "(", ")", "{", ...
Calculate the size of "right language" for each state in an FSA. The right language is the number of sequences encoded from a given node in the automaton. @param fsa The automaton to calculate right language for. @return Returns a map with node identifiers as keys and their right language counts as associated values.
[ "Calculate", "the", "size", "of", "right", "language", "for", "each", "state", "in", "an", "FSA", ".", "The", "right", "language", "is", "the", "number", "of", "sequences", "encoded", "from", "a", "given", "node", "in", "the", "automaton", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSAUtils.java#L177-L194
101,524
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/CFSA2.java
CFSA2.readVInt
static int readVInt(byte[] array, int offset) { byte b = array[offset]; int value = b & 0x7F; for (int shift = 7; b < 0; shift += 7) { b = array[++offset]; value |= (b & 0x7F) << shift; } return value; }
java
static int readVInt(byte[] array, int offset) { byte b = array[offset]; int value = b & 0x7F; for (int shift = 7; b < 0; shift += 7) { b = array[++offset]; value |= (b & 0x7F) << shift; } return value; }
[ "static", "int", "readVInt", "(", "byte", "[", "]", "array", ",", "int", "offset", ")", "{", "byte", "b", "=", "array", "[", "offset", "]", ";", "int", "value", "=", "b", "&", "0x7F", ";", "for", "(", "int", "shift", "=", "7", ";", "b", "<", ...
Read a v-int.
[ "Read", "a", "v", "-", "int", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/CFSA2.java#L353-L363
101,525
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java
Dictionary.read
public static Dictionary read(Path location) throws IOException { final Path metadata = DictionaryMetadata.getExpectedMetadataLocation(location); try (InputStream fsaStream = Files.newInputStream(location); InputStream metadataStream = Files.newInputStream(metadata)) { return read(fsaStream...
java
public static Dictionary read(Path location) throws IOException { final Path metadata = DictionaryMetadata.getExpectedMetadataLocation(location); try (InputStream fsaStream = Files.newInputStream(location); InputStream metadataStream = Files.newInputStream(metadata)) { return read(fsaStream...
[ "public", "static", "Dictionary", "read", "(", "Path", "location", ")", "throws", "IOException", "{", "final", "Path", "metadata", "=", "DictionaryMetadata", ".", "getExpectedMetadataLocation", "(", "location", ")", ";", "try", "(", "InputStream", "fsaStream", "="...
Attempts to load a dictionary using the path to the FSA file and the expected metadata extension. @param location The location of the dictionary file (<code>*.dict</code>). @return An instantiated dictionary. @throws IOException if an I/O error occurs.
[ "Attempts", "to", "load", "a", "dictionary", "using", "the", "path", "to", "the", "FSA", "file", "and", "the", "expected", "metadata", "extension", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java#L60-L67
101,526
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java
Dictionary.read
public static Dictionary read(URL dictURL) throws IOException { final URL expectedMetadataURL; try { String external = dictURL.toExternalForm(); expectedMetadataURL = new URL(DictionaryMetadata.getExpectedMetadataFileName(external)); } catch (MalformedURLException e) { throw new IOEx...
java
public static Dictionary read(URL dictURL) throws IOException { final URL expectedMetadataURL; try { String external = dictURL.toExternalForm(); expectedMetadataURL = new URL(DictionaryMetadata.getExpectedMetadataFileName(external)); } catch (MalformedURLException e) { throw new IOEx...
[ "public", "static", "Dictionary", "read", "(", "URL", "dictURL", ")", "throws", "IOException", "{", "final", "URL", "expectedMetadataURL", ";", "try", "{", "String", "external", "=", "dictURL", ".", "toExternalForm", "(", ")", ";", "expectedMetadataURL", "=", ...
Attempts to load a dictionary using the URL to the FSA file and the expected metadata extension. @param dictURL The URL pointing to the dictionary file (<code>*.dict</code>). @return An instantiated dictionary. @throws IOException if an I/O error occurs.
[ "Attempts", "to", "load", "a", "dictionary", "using", "the", "URL", "to", "the", "FSA", "file", "and", "the", "expected", "metadata", "extension", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java#L77-L90
101,527
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java
Dictionary.read
public static Dictionary read(InputStream fsaStream, InputStream metadataStream) throws IOException { return new Dictionary(FSA.read(fsaStream), DictionaryMetadata.read(metadataStream)); }
java
public static Dictionary read(InputStream fsaStream, InputStream metadataStream) throws IOException { return new Dictionary(FSA.read(fsaStream), DictionaryMetadata.read(metadataStream)); }
[ "public", "static", "Dictionary", "read", "(", "InputStream", "fsaStream", ",", "InputStream", "metadataStream", ")", "throws", "IOException", "{", "return", "new", "Dictionary", "(", "FSA", ".", "read", "(", "fsaStream", ")", ",", "DictionaryMetadata", ".", "re...
Attempts to load a dictionary from opened streams of FSA dictionary data and associated metadata. Input streams are not closed automatically. @param fsaStream The stream with FSA data @param metadataStream The stream with metadata @return Returns an instantiated {@link Dictionary}. @throws IOException if an I/O error ...
[ "Attempts", "to", "load", "a", "dictionary", "from", "opened", "streams", "of", "FSA", "dictionary", "data", "and", "associated", "metadata", ".", "Input", "streams", "are", "not", "closed", "automatically", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java#L101-L103
101,528
morfologik/morfologik-stemming
morfologik-speller/src/main/java/morfologik/speller/HMatrix.java
HMatrix.set
public void set(final int i, final int j, final int val) { p[(j - i + editDistance + 1) * rowLength + j] = val; }
java
public void set(final int i, final int j, final int val) { p[(j - i + editDistance + 1) * rowLength + j] = val; }
[ "public", "void", "set", "(", "final", "int", "i", ",", "final", "int", "j", ",", "final", "int", "val", ")", "{", "p", "[", "(", "j", "-", "i", "+", "editDistance", "+", "1", ")", "*", "rowLength", "+", "j", "]", "=", "val", ";", "}" ]
Set an item in hMatrix. No checking for i &amp; j is done. They must be correct. @param i - (int) row number; @param j - (int) column number; @param val - (int) value to put there.
[ "Set", "an", "item", "in", "hMatrix", ".", "No", "checking", "for", "i", "&amp", ";", "j", "is", "done", ".", "They", "must", "be", "correct", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/HMatrix.java#L94-L96
101,529
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/ByteSequenceIterator.java
ByteSequenceIterator.advance
private final ByteBuffer advance() { if (position == 0) { return null; } while (position > 0) { final int lastIndex = position - 1; final int arc = arcs[lastIndex]; if (arc == 0) { // Remove the current node from the queue. position--; continue; ...
java
private final ByteBuffer advance() { if (position == 0) { return null; } while (position > 0) { final int lastIndex = position - 1; final int arc = arcs[lastIndex]; if (arc == 0) { // Remove the current node from the queue. position--; continue; ...
[ "private", "final", "ByteBuffer", "advance", "(", ")", "{", "if", "(", "position", "==", "0", ")", "{", "return", "null", ";", "}", "while", "(", "position", ">", "0", ")", "{", "final", "int", "lastIndex", "=", "position", "-", "1", ";", "final", ...
Advances to the next available final state.
[ "Advances", "to", "the", "next", "available", "final", "state", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/ByteSequenceIterator.java#L107-L147
101,530
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/ByteSequenceIterator.java
ByteSequenceIterator.pushNode
private void pushNode(int node) { // Expand buffers if needed. if (position == arcs.length) { arcs = Arrays.copyOf(arcs, arcs.length + EXPECTED_MAX_STATES); } arcs[position++] = fsa.getFirstArc(node); }
java
private void pushNode(int node) { // Expand buffers if needed. if (position == arcs.length) { arcs = Arrays.copyOf(arcs, arcs.length + EXPECTED_MAX_STATES); } arcs[position++] = fsa.getFirstArc(node); }
[ "private", "void", "pushNode", "(", "int", "node", ")", "{", "// Expand buffers if needed.\r", "if", "(", "position", "==", "arcs", ".", "length", ")", "{", "arcs", "=", "Arrays", ".", "copyOf", "(", "arcs", ",", "arcs", ".", "length", "+", "EXPECTED_MAX_S...
Descends to a given node, adds its arcs to the stack to be traversed.
[ "Descends", "to", "a", "given", "node", "adds", "its", "arcs", "to", "the", "stack", "to", "be", "traversed", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/ByteSequenceIterator.java#L160-L167
101,531
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/FSAHeader.java
FSAHeader.read
public static FSAHeader read(InputStream in) throws IOException { if (in.read() != ((FSA_MAGIC >>> 24) ) || in.read() != ((FSA_MAGIC >>> 16) & 0xff) || in.read() != ((FSA_MAGIC >>> 8) & 0xff) || in.read() != ((FSA_MAGIC ) & 0xff)) { throw new IOException("Invalid file head...
java
public static FSAHeader read(InputStream in) throws IOException { if (in.read() != ((FSA_MAGIC >>> 24) ) || in.read() != ((FSA_MAGIC >>> 16) & 0xff) || in.read() != ((FSA_MAGIC >>> 8) & 0xff) || in.read() != ((FSA_MAGIC ) & 0xff)) { throw new IOException("Invalid file head...
[ "public", "static", "FSAHeader", "read", "(", "InputStream", "in", ")", "throws", "IOException", "{", "if", "(", "in", ".", "read", "(", ")", "!=", "(", "(", "FSA_MAGIC", ">>>", "24", ")", ")", "||", "in", ".", "read", "(", ")", "!=", "(", "(", "...
Read FSA header and version from a stream, consuming read bytes. @param in The input stream to read data from. @return Returns a valid {@link FSAHeader} with version information. @throws IOException If the stream ends prematurely or if it contains invalid data.
[ "Read", "FSA", "header", "and", "version", "from", "a", "stream", "consuming", "read", "bytes", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/FSAHeader.java#L40-L54
101,532
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/FSAHeader.java
FSAHeader.write
public static void write(OutputStream os, byte version) throws IOException { os.write(FSA_MAGIC >> 24); os.write(FSA_MAGIC >> 16); os.write(FSA_MAGIC >> 8); os.write(FSA_MAGIC); os.write(version); }
java
public static void write(OutputStream os, byte version) throws IOException { os.write(FSA_MAGIC >> 24); os.write(FSA_MAGIC >> 16); os.write(FSA_MAGIC >> 8); os.write(FSA_MAGIC); os.write(version); }
[ "public", "static", "void", "write", "(", "OutputStream", "os", ",", "byte", "version", ")", "throws", "IOException", "{", "os", ".", "write", "(", "FSA_MAGIC", ">>", "24", ")", ";", "os", ".", "write", "(", "FSA_MAGIC", ">>", "16", ")", ";", "os", "...
Writes FSA magic bytes and version information. @param os The stream to write to. @param version Automaton version. @throws IOException Rethrown if writing fails.
[ "Writes", "FSA", "magic", "bytes", "and", "version", "information", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/FSAHeader.java#L63-L69
101,533
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/FSA5.java
FSA5.decodeFromBytes
static final int decodeFromBytes(final byte[] arcs, final int start, final int n) { int r = 0; for (int i = n; --i >= 0;) { r = r << 8 | (arcs[start + i] & 0xff); } return r; }
java
static final int decodeFromBytes(final byte[] arcs, final int start, final int n) { int r = 0; for (int i = n; --i >= 0;) { r = r << 8 | (arcs[start + i] & 0xff); } return r; }
[ "static", "final", "int", "decodeFromBytes", "(", "final", "byte", "[", "]", "arcs", ",", "final", "int", "start", ",", "final", "int", "n", ")", "{", "int", "r", "=", "0", ";", "for", "(", "int", "i", "=", "n", ";", "--", "i", ">=", "0", ";", ...
Returns an n-byte integer encoded in byte-packed representation.
[ "Returns", "an", "n", "-", "byte", "integer", "encoded", "in", "byte", "-", "packed", "representation", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/FSA5.java#L289-L295
101,534
morfologik/morfologik-stemming
morfologik-tools/src/main/java/morfologik/tools/CliTool.java
CliTool.main
protected static void main(String[] args, CliTool... commands) { if (commands.length == 1) { main(args, commands[0]); } else { JCommander jc = new JCommander(); for (CliTool command : commands) { jc.addCommand(command); } jc.addConverterFactory(new CustomParameterCo...
java
protected static void main(String[] args, CliTool... commands) { if (commands.length == 1) { main(args, commands[0]); } else { JCommander jc = new JCommander(); for (CliTool command : commands) { jc.addCommand(command); } jc.addConverterFactory(new CustomParameterCo...
[ "protected", "static", "void", "main", "(", "String", "[", "]", "args", ",", "CliTool", "...", "commands", ")", "{", "if", "(", "commands", ".", "length", "==", "1", ")", "{", "main", "(", "args", ",", "commands", "[", "0", "]", ")", ";", "}", "e...
Parse and execute one of the commands. @param args Command line arguments (command and options). @param commands A list of commands.
[ "Parse", "and", "execute", "one", "of", "the", "commands", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-tools/src/main/java/morfologik/tools/CliTool.java#L57-L114
101,535
morfologik/morfologik-stemming
morfologik-tools/src/main/java/morfologik/tools/CliTool.java
CliTool.main
protected static void main(String[] args, CliTool command) { JCommander jc = new JCommander(command); jc.addConverterFactory(new CustomParameterConverters()); jc.setProgramName(command.getClass().getAnnotation(Parameters.class).commandNames()[0]); ExitStatus exitStatus = ExitStatus.SUCCESS; t...
java
protected static void main(String[] args, CliTool command) { JCommander jc = new JCommander(command); jc.addConverterFactory(new CustomParameterConverters()); jc.setProgramName(command.getClass().getAnnotation(Parameters.class).commandNames()[0]); ExitStatus exitStatus = ExitStatus.SUCCESS; t...
[ "protected", "static", "void", "main", "(", "String", "[", "]", "args", ",", "CliTool", "command", ")", "{", "JCommander", "jc", "=", "new", "JCommander", "(", "command", ")", ";", "jc", ".", "addConverterFactory", "(", "new", "CustomParameterConverters", "(...
Parse and execute a single command. @param args Command line arguments (command and options). @param command The command to execute.
[ "Parse", "and", "execute", "a", "single", "command", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-tools/src/main/java/morfologik/tools/CliTool.java#L122-L165
101,536
morfologik/morfologik-stemming
morfologik-tools/src/main/java/morfologik/tools/FSAInfo.java
FSAInfo.byteAsChar
static String byteAsChar(byte v) { int chr = v & 0xff; return String.format(Locale.ROOT, "%s (0x%02x)", (Character.isWhitespace(chr) || chr > 127) ? "[non-printable]" : Character.toString((char) chr), v & 0xFF); }
java
static String byteAsChar(byte v) { int chr = v & 0xff; return String.format(Locale.ROOT, "%s (0x%02x)", (Character.isWhitespace(chr) || chr > 127) ? "[non-printable]" : Character.toString((char) chr), v & 0xFF); }
[ "static", "String", "byteAsChar", "(", "byte", "v", ")", "{", "int", "chr", "=", "v", "&", "0xff", ";", "return", "String", ".", "format", "(", "Locale", ".", "ROOT", ",", "\"%s (0x%02x)\"", ",", "(", "Character", ".", "isWhitespace", "(", "chr", ")", ...
Convert a byte to an informative string.
[ "Convert", "a", "byte", "to", "an", "informative", "string", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-tools/src/main/java/morfologik/tools/FSAInfo.java#L87-L93
101,537
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/FSA.java
FSA.read
public static FSA read(InputStream stream) throws IOException { final FSAHeader header = FSAHeader.read(stream); switch (header.version) { case FSA5.VERSION: return new FSA5(stream); case CFSA.VERSION: return new CFSA(stream); case CFSA2.VERSION: return new CF...
java
public static FSA read(InputStream stream) throws IOException { final FSAHeader header = FSAHeader.read(stream); switch (header.version) { case FSA5.VERSION: return new FSA5(stream); case CFSA.VERSION: return new CFSA(stream); case CFSA2.VERSION: return new CF...
[ "public", "static", "FSA", "read", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "final", "FSAHeader", "header", "=", "FSAHeader", ".", "read", "(", "stream", ")", ";", "switch", "(", "header", ".", "version", ")", "{", "case", "FSA5", ...
A factory for reading automata in any of the supported versions. @param stream The input stream to read automaton data from. The stream is not closed. @return Returns an instantiated automaton. Never null. @throws IOException If the input stream does not represent an automaton or is otherwise invalid.
[ "A", "factory", "for", "reading", "automata", "in", "any", "of", "the", "supported", "versions", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/FSA.java#L311-L325
101,538
morfologik/morfologik-stemming
morfologik-fsa/src/main/java/morfologik/fsa/FSA.java
FSA.read
public static <T extends FSA> T read(InputStream stream, Class<? extends T> clazz) throws IOException { FSA fsa = read(stream); if (!clazz.isInstance(fsa)) { throw new IOException(String.format(Locale.ROOT, "Expected FSA type %s, but read an incompatible type %s.", clazz.getName(), fsa.getCl...
java
public static <T extends FSA> T read(InputStream stream, Class<? extends T> clazz) throws IOException { FSA fsa = read(stream); if (!clazz.isInstance(fsa)) { throw new IOException(String.format(Locale.ROOT, "Expected FSA type %s, but read an incompatible type %s.", clazz.getName(), fsa.getCl...
[ "public", "static", "<", "T", "extends", "FSA", ">", "T", "read", "(", "InputStream", "stream", ",", "Class", "<", "?", "extends", "T", ">", "clazz", ")", "throws", "IOException", "{", "FSA", "fsa", "=", "read", "(", "stream", ")", ";", "if", "(", ...
A factory for reading a specific FSA subclass, including proper casting. @param stream The input stream to read automaton data from. The stream is not closed. @param clazz A subclass of {@link FSA} to cast the read automaton to. @param <T> A subclass of {@link FSA} to cast the read automaton to. @return Returns an ins...
[ "A", "factory", "for", "reading", "a", "specific", "FSA", "subclass", "including", "proper", "casting", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa/src/main/java/morfologik/fsa/FSA.java#L341-L348
101,539
morfologik/morfologik-stemming
morfologik-tools/src/main/java/morfologik/tools/BinaryInput.java
BinaryInput.forAllLines
private static int forAllLines(InputStream is, byte separator, LineConsumer lineConsumer) throws IOException { int lines = 0; byte[] buffer = new byte[0]; int b, pos = 0; while ((b = is.read()) != -1) { if (b == separator) { buffer = lineConsumer.process(buffer, pos); pos = ...
java
private static int forAllLines(InputStream is, byte separator, LineConsumer lineConsumer) throws IOException { int lines = 0; byte[] buffer = new byte[0]; int b, pos = 0; while ((b = is.read()) != -1) { if (b == separator) { buffer = lineConsumer.process(buffer, pos); pos = ...
[ "private", "static", "int", "forAllLines", "(", "InputStream", "is", ",", "byte", "separator", ",", "LineConsumer", "lineConsumer", ")", "throws", "IOException", "{", "int", "lines", "=", "0", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "0", ...
Read all byte-separated sequences.
[ "Read", "all", "byte", "-", "separated", "sequences", "." ]
9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-tools/src/main/java/morfologik/tools/BinaryInput.java#L105-L127
101,540
kohsuke/jcifs
src/jcifs/http/NtlmSsp.java
NtlmSsp.authenticate
public static NtlmPasswordAuthentication authenticate( HttpServletRequest req, HttpServletResponse resp, byte[] challenge) throws IOException, ServletException { String msg = req.getHeader("Authorization"); if (msg != null && msg.startsWith("NTLM ")) { by...
java
public static NtlmPasswordAuthentication authenticate( HttpServletRequest req, HttpServletResponse resp, byte[] challenge) throws IOException, ServletException { String msg = req.getHeader("Authorization"); if (msg != null && msg.startsWith("NTLM ")) { by...
[ "public", "static", "NtlmPasswordAuthentication", "authenticate", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ",", "byte", "[", "]", "challenge", ")", "throws", "IOException", ",", "ServletException", "{", "String", "msg", "=", "req", ".", ...
Performs NTLM authentication for the servlet request. @param req The request being serviced. @param resp The response. @param challenge The domain controller challenge. @throws IOException If an IO error occurs. @throws ServletException If an error occurs.
[ "Performs", "NTLM", "authentication", "for", "the", "servlet", "request", "." ]
7751f4e4826c35614d237a70c2582553f95b58de
https://github.com/kohsuke/jcifs/blob/7751f4e4826c35614d237a70c2582553f95b58de/src/jcifs/http/NtlmSsp.java#L81-L108
101,541
kohsuke/jcifs
src/jcifs/smb/SigningDigest.java
SigningDigest.verify
boolean verify(byte[] data, int offset, ServerMessageBlock response) { update(macSigningKey, 0, macSigningKey.length); int index = offset; update(data, index, ServerMessageBlock.SIGNATURE_OFFSET); index += ServerMessageBlock.SIGNATURE_OFFSET; byte[] sequence = new byte[8]; ...
java
boolean verify(byte[] data, int offset, ServerMessageBlock response) { update(macSigningKey, 0, macSigningKey.length); int index = offset; update(data, index, ServerMessageBlock.SIGNATURE_OFFSET); index += ServerMessageBlock.SIGNATURE_OFFSET; byte[] sequence = new byte[8]; ...
[ "boolean", "verify", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "ServerMessageBlock", "response", ")", "{", "update", "(", "macSigningKey", ",", "0", ",", "macSigningKey", ".", "length", ")", ";", "int", "index", "=", "offset", ";", "updat...
Performs MAC signature verification. This calculates the signature of the SMB and compares it to the signature field on the SMB itself. @param data The data. @param offset The starting offset at which the SMB header begins. @param length The length of the SMB data starting at offset.
[ "Performs", "MAC", "signature", "verification", ".", "This", "calculates", "the", "signature", "of", "the", "SMB", "and", "compares", "it", "to", "the", "signature", "field", "on", "the", "SMB", "itself", "." ]
7751f4e4826c35614d237a70c2582553f95b58de
https://github.com/kohsuke/jcifs/blob/7751f4e4826c35614d237a70c2582553f95b58de/src/jcifs/smb/SigningDigest.java#L158-L191
101,542
kohsuke/jcifs
src/jcifs/util/Base64.java
Base64.encode
public static String encode(byte[] bytes) { int length = bytes.length; if (length == 0) return ""; StringBuffer buffer = new StringBuffer((int) Math.ceil((double) length / 3d) * 4); int remainder = length % 3; length -= remainder; int block; ...
java
public static String encode(byte[] bytes) { int length = bytes.length; if (length == 0) return ""; StringBuffer buffer = new StringBuffer((int) Math.ceil((double) length / 3d) * 4); int remainder = length % 3; length -= remainder; int block; ...
[ "public", "static", "String", "encode", "(", "byte", "[", "]", "bytes", ")", "{", "int", "length", "=", "bytes", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "\"\"", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ...
Base-64 encodes the supplied block of data. Line wrapping is not applied on output. @param bytes The block of data that is to be Base-64 encoded. @return A <code>String</code> containing the encoded data.
[ "Base", "-", "64", "encodes", "the", "supplied", "block", "of", "data", ".", "Line", "wrapping", "is", "not", "applied", "on", "output", "." ]
7751f4e4826c35614d237a70c2582553f95b58de
https://github.com/kohsuke/jcifs/blob/7751f4e4826c35614d237a70c2582553f95b58de/src/jcifs/util/Base64.java#L33-L64
101,543
kohsuke/jcifs
src/jcifs/util/Base64.java
Base64.decode
public static byte[] decode(String string) { int length = string.length(); if (length == 0) return new byte[0]; int pad = (string.charAt(length - 2) == '=') ? 2 : (string.charAt(length - 1) == '=') ? 1 : 0; int size = length * 3 / 4 - pad; byte[] buffer = ne...
java
public static byte[] decode(String string) { int length = string.length(); if (length == 0) return new byte[0]; int pad = (string.charAt(length - 2) == '=') ? 2 : (string.charAt(length - 1) == '=') ? 1 : 0; int size = length * 3 / 4 - pad; byte[] buffer = ne...
[ "public", "static", "byte", "[", "]", "decode", "(", "String", "string", ")", "{", "int", "length", "=", "string", ".", "length", "(", ")", ";", "if", "(", "length", "==", "0", ")", "return", "new", "byte", "[", "0", "]", ";", "int", "pad", "=", ...
Decodes the supplied Base-64 encoded string. @param string The Base-64 encoded string that is to be decoded. @return A <code>byte[]</code> containing the decoded data block.
[ "Decodes", "the", "supplied", "Base", "-", "64", "encoded", "string", "." ]
7751f4e4826c35614d237a70c2582553f95b58de
https://github.com/kohsuke/jcifs/blob/7751f4e4826c35614d237a70c2582553f95b58de/src/jcifs/util/Base64.java#L72-L92
101,544
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Post.java
Post.reblog
public Post reblog(String blogName, Map<String, ?> options) { return client.postReblog(blogName, id, reblog_key, options); }
java
public Post reblog(String blogName, Map<String, ?> options) { return client.postReblog(blogName, id, reblog_key, options); }
[ "public", "Post", "reblog", "(", "String", "blogName", ",", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "client", ".", "postReblog", "(", "blogName", ",", "id", ",", "reblog_key", ",", "options", ")", ";", "}" ]
Reblog this post @param blogName the blog name to reblog onto @param options options to reblog with (or null) @return reblogged post
[ "Reblog", "this", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Post.java#L307-L309
101,545
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Post.java
Post.setDate
public void setDate(Date date) { DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("GMT")); setDate(df.format(date)); }
java
public void setDate(Date date) { DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("GMT")); setDate(df.format(date)); }
[ "public", "void", "setDate", "(", "Date", "date", ")", "{", "DateFormat", "df", "=", "new", "SimpleDateFormat", "(", "\"yyyy/MM/dd HH:mm:ss\"", ")", ";", "df", ".", "setTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "\"GMT\"", ")", ")", ";", "setDate",...
Set the date as a date @param date the date to set
[ "Set", "the", "date", "as", "a", "date" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Post.java#L373-L377
101,546
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Post.java
Post.addTag
public void addTag(String tag) { if (this.tags == null) { tags = new ArrayList<String>(); } this.tags.add(tag); }
java
public void addTag(String tag) { if (this.tags == null) { tags = new ArrayList<String>(); } this.tags.add(tag); }
[ "public", "void", "addTag", "(", "String", "tag", ")", "{", "if", "(", "this", ".", "tags", "==", "null", ")", "{", "tags", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "}", "this", ".", "tags", ".", "add", "(", "tag", ")", ";", ...
Add a tag @param tag the tag
[ "Add", "a", "tag" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Post.java#L400-L405
101,547
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Post.java
Post.save
public void save() throws IOException { if (id == null) { this.id = client.postCreate(blog_name, detail()); } else { client.postEdit(blog_name, id, detail()); } }
java
public void save() throws IOException { if (id == null) { this.id = client.postCreate(blog_name, detail()); } else { client.postEdit(blog_name, id, detail()); } }
[ "public", "void", "save", "(", ")", "throws", "IOException", "{", "if", "(", "id", "==", "null", ")", "{", "this", ".", "id", "=", "client", ".", "postCreate", "(", "blog_name", ",", "detail", "(", ")", ")", ";", "}", "else", "{", "client", ".", ...
Save this post @throws IOException if a file in detail cannot be read
[ "Save", "this", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Post.java#L419-L425
101,548
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Post.java
Post.detail
protected Map<String, Object> detail() { final Map<String, Object> map = new HashMap<String, Object>(); map.put("state", state); map.put("tags", getTagString()); map.put("format", format); map.put("slug", slug); map.put("date", date); map.put("type", getType().get...
java
protected Map<String, Object> detail() { final Map<String, Object> map = new HashMap<String, Object>(); map.put("state", state); map.put("tags", getTagString()); map.put("format", format); map.put("slug", slug); map.put("date", date); map.put("type", getType().get...
[ "protected", "Map", "<", "String", ",", "Object", ">", "detail", "(", ")", "{", "final", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "map", ".", "put", "(", "\"state\"", ...
Detail for this post @return the detail
[ "Detail", "for", "this", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Post.java#L431-L440
101,549
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/PhotoPost.java
PhotoPost.setPhoto
public void setPhoto(Photo photo) { PhotoType type = photo.getType(); if (postType != null && !postType.equals(type)) { throw new IllegalArgumentException("Photos must all be the same type (source or data)"); } else if (postType == PhotoType.SOURCE && pendingPhotos.size() > 0) { ...
java
public void setPhoto(Photo photo) { PhotoType type = photo.getType(); if (postType != null && !postType.equals(type)) { throw new IllegalArgumentException("Photos must all be the same type (source or data)"); } else if (postType == PhotoType.SOURCE && pendingPhotos.size() > 0) { ...
[ "public", "void", "setPhoto", "(", "Photo", "photo", ")", "{", "PhotoType", "type", "=", "photo", ".", "getType", "(", ")", ";", "if", "(", "postType", "!=", "null", "&&", "!", "postType", ".", "equals", "(", "type", ")", ")", "{", "throw", "new", ...
Set the photo for this post @param photo the photo to add
[ "Set", "the", "photo", "for", "this", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/PhotoPost.java#L77-L87
101,550
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/User.java
User.getBlogs
public List<Blog> getBlogs() { if (blogs != null) { for (Blog blog : blogs) { blog.setClient(client); } } return this.blogs; }
java
public List<Blog> getBlogs() { if (blogs != null) { for (Blog blog : blogs) { blog.setClient(client); } } return this.blogs; }
[ "public", "List", "<", "Blog", ">", "getBlogs", "(", ")", "{", "if", "(", "blogs", "!=", "null", ")", "{", "for", "(", "Blog", "blog", ":", "blogs", ")", "{", "blog", ".", "setClient", "(", "client", ")", ";", "}", "}", "return", "this", ".", "...
Get the blog List for this user @return The blog List for this user
[ "Get", "the", "blog", "List", "for", "this", "user" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/User.java#L61-L68
101,551
tumblr/jumblr
src/main/java/com/tumblr/jumblr/exceptions/JumblrException.java
JumblrException.extractErrors
private void extractErrors(JsonObject object) { JsonObject response; try { response = object.getAsJsonObject("response"); } catch (ClassCastException ex) { return; // response is non-object } if (response == null) { return; } JsonArray e = respons...
java
private void extractErrors(JsonObject object) { JsonObject response; try { response = object.getAsJsonObject("response"); } catch (ClassCastException ex) { return; // response is non-object } if (response == null) { return; } JsonArray e = respons...
[ "private", "void", "extractErrors", "(", "JsonObject", "object", ")", "{", "JsonObject", "response", ";", "try", "{", "response", "=", "object", ".", "getAsJsonObject", "(", "\"response\"", ")", ";", "}", "catch", "(", "ClassCastException", "ex", ")", "{", "...
Pull the errors out of the response if present @param object the parsed response object
[ "Pull", "the", "errors", "out", "of", "the", "response", "if", "present" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/exceptions/JumblrException.java#L74-L91
101,552
tumblr/jumblr
src/main/java/com/tumblr/jumblr/exceptions/JumblrException.java
JumblrException.extractMessage
private void extractMessage(JsonObject object) { // Prefer to pull the message out of meta JsonObject meta = object.getAsJsonObject("meta"); if (meta != null) { JsonPrimitive msg = meta.getAsJsonPrimitive("msg"); if (msg != null) { this.message = msg.getAs...
java
private void extractMessage(JsonObject object) { // Prefer to pull the message out of meta JsonObject meta = object.getAsJsonObject("meta"); if (meta != null) { JsonPrimitive msg = meta.getAsJsonPrimitive("msg"); if (msg != null) { this.message = msg.getAs...
[ "private", "void", "extractMessage", "(", "JsonObject", "object", ")", "{", "// Prefer to pull the message out of meta", "JsonObject", "meta", "=", "object", ".", "getAsJsonObject", "(", "\"meta\"", ")", ";", "if", "(", "meta", "!=", "null", ")", "{", "JsonPrimiti...
Pull the message out of the response @param object the parsed response object
[ "Pull", "the", "message", "out", "of", "the", "response" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/exceptions/JumblrException.java#L97-L117
101,553
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.xauth
public void xauth(final String email, final String password) { setToken(this.requestBuilder.postXAuth(email, password)); }
java
public void xauth(final String email, final String password) { setToken(this.requestBuilder.postXAuth(email, password)); }
[ "public", "void", "xauth", "(", "final", "String", "email", ",", "final", "String", "password", ")", "{", "setToken", "(", "this", ".", "requestBuilder", ".", "postXAuth", "(", "email", ",", "password", ")", ")", ";", "}" ]
Performs an XAuth authentication. @param email the user's login email. @param password the user's login password.
[ "Performs", "an", "XAuth", "authentication", "." ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L75-L77
101,554
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.userDashboard
public List<Post> userDashboard(Map<String, ?> options) { return requestBuilder.get("/user/dashboard", options).getPosts(); }
java
public List<Post> userDashboard(Map<String, ?> options) { return requestBuilder.get("/user/dashboard", options).getPosts(); }
[ "public", "List", "<", "Post", ">", "userDashboard", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "requestBuilder", ".", "get", "(", "\"/user/dashboard\"", ",", "options", ")", ".", "getPosts", "(", ")", ";", "}" ]
Get the user dashboard for the authenticated User @param options the options for the call (or null) @return A List of posts
[ "Get", "the", "user", "dashboard", "for", "the", "authenticated", "User" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L92-L94
101,555
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.userFollowing
public List<Blog> userFollowing(Map<String, ?> options) { return requestBuilder.get("/user/following", options).getBlogs(); }
java
public List<Blog> userFollowing(Map<String, ?> options) { return requestBuilder.get("/user/following", options).getBlogs(); }
[ "public", "List", "<", "Blog", ">", "userFollowing", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "requestBuilder", ".", "get", "(", "\"/user/following\"", ",", "options", ")", ".", "getBlogs", "(", ")", ";", "}" ]
Get the blogs the given user is following @param options the options @return a List of blogs
[ "Get", "the", "blogs", "the", "given", "user", "is", "following" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L105-L107
101,556
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.blogInfo
public Blog blogInfo(String blogName) { Map<String, String> map = new HashMap<String, String>(); map.put("api_key", this.apiKey); return requestBuilder.get(JumblrClient.blogPath(blogName, "/info"), map).getBlog(); }
java
public Blog blogInfo(String blogName) { Map<String, String> map = new HashMap<String, String>(); map.put("api_key", this.apiKey); return requestBuilder.get(JumblrClient.blogPath(blogName, "/info"), map).getBlog(); }
[ "public", "Blog", "blogInfo", "(", "String", "blogName", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"api_key\"", ",", "this", ".", "a...
Get the blog info for a given blog @param blogName the Name of the blog @return The Blog object for this blog
[ "Get", "the", "blog", "info", "for", "a", "given", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L136-L140
101,557
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.blogFollowers
public List<User> blogFollowers(String blogName, Map<String, ?> options) { return requestBuilder.get(JumblrClient.blogPath(blogName, "/followers"), options).getUsers(); }
java
public List<User> blogFollowers(String blogName, Map<String, ?> options) { return requestBuilder.get(JumblrClient.blogPath(blogName, "/followers"), options).getUsers(); }
[ "public", "List", "<", "User", ">", "blogFollowers", "(", "String", "blogName", ",", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "requestBuilder", ".", "get", "(", "JumblrClient", ".", "blogPath", "(", "blogName", ",", "\"/followers...
Get the followers for a given blog @param blogName the name of the blog @param options the options for this call (or null) @return the blog object for this blog
[ "Get", "the", "followers", "for", "a", "given", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L148-L150
101,558
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.blogLikes
public List<Post> blogLikes(String blogName, Map<String, ?> options) { if (options == null) { options = Collections.emptyMap(); } Map<String, Object> soptions = JumblrClient.safeOptionMap(options); soptions.put("api_key", this.apiKey); return requestBuilder.get(Jumblr...
java
public List<Post> blogLikes(String blogName, Map<String, ?> options) { if (options == null) { options = Collections.emptyMap(); } Map<String, Object> soptions = JumblrClient.safeOptionMap(options); soptions.put("api_key", this.apiKey); return requestBuilder.get(Jumblr...
[ "public", "List", "<", "Post", ">", "blogLikes", "(", "String", "blogName", ",", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "if", "(", "options", "==", "null", ")", "{", "options", "=", "Collections", ".", "emptyMap", "(", ")", ";", ...
Get the public likes for a given blog @param blogName the name of the blog @param options the options for this call (or null) @return a List of posts
[ "Get", "the", "public", "likes", "for", "a", "given", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L160-L167
101,559
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.blogPosts
public List<Post> blogPosts(String blogName, Map<String, ?> options) { if (options == null) { options = Collections.emptyMap(); } Map<String, Object> soptions = JumblrClient.safeOptionMap(options); soptions.put("api_key", apiKey); String path = "/posts"; if (...
java
public List<Post> blogPosts(String blogName, Map<String, ?> options) { if (options == null) { options = Collections.emptyMap(); } Map<String, Object> soptions = JumblrClient.safeOptionMap(options); soptions.put("api_key", apiKey); String path = "/posts"; if (...
[ "public", "List", "<", "Post", ">", "blogPosts", "(", "String", "blogName", ",", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "if", "(", "options", "==", "null", ")", "{", "options", "=", "Collections", ".", "emptyMap", "(", ")", ";", ...
Get the posts for a given blog @param blogName the name of the blog @param options the options for this call (or null) @return a List of posts
[ "Get", "the", "posts", "for", "a", "given", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L179-L192
101,560
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.blogPost
public Post blogPost(String blogName, Long postId) { HashMap<String, String> options = new HashMap<String, String>(); options.put("id", postId.toString()); List<Post> posts = this.blogPosts(blogName, options); return posts.size() > 0 ? posts.get(0) : null; }
java
public Post blogPost(String blogName, Long postId) { HashMap<String, String> options = new HashMap<String, String>(); options.put("id", postId.toString()); List<Post> posts = this.blogPosts(blogName, options); return posts.size() > 0 ? posts.get(0) : null; }
[ "public", "Post", "blogPost", "(", "String", "blogName", ",", "Long", "postId", ")", "{", "HashMap", "<", "String", ",", "String", ">", "options", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "options", ".", "put", "(", "\...
Get an individual post by id @param blogName the name of the blog @param postId the id of the post to get @return the Post or null
[ "Get", "an", "individual", "post", "by", "id" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L204-L209
101,561
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.blogQueuedPosts
public List<Post> blogQueuedPosts(String blogName, Map<String, ?> options) { return requestBuilder.get(JumblrClient.blogPath(blogName, "/posts/queue"), options).getPosts(); }
java
public List<Post> blogQueuedPosts(String blogName, Map<String, ?> options) { return requestBuilder.get(JumblrClient.blogPath(blogName, "/posts/queue"), options).getPosts(); }
[ "public", "List", "<", "Post", ">", "blogQueuedPosts", "(", "String", "blogName", ",", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "requestBuilder", ".", "get", "(", "JumblrClient", ".", "blogPath", "(", "blogName", ",", "\"/posts/q...
Get the queued posts for a given blog @param blogName the name of the blog @param options the options for this call (or null) @return a List of posts
[ "Get", "the", "queued", "posts", "for", "a", "given", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L217-L219
101,562
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.userLikes
public List<Post> userLikes(Map<String, ?> options) { return requestBuilder.get("/user/likes", options).getLikedPosts(); }
java
public List<Post> userLikes(Map<String, ?> options) { return requestBuilder.get("/user/likes", options).getLikedPosts(); }
[ "public", "List", "<", "Post", ">", "userLikes", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "requestBuilder", ".", "get", "(", "\"/user/likes\"", ",", "options", ")", ".", "getLikedPosts", "(", ")", ";", "}" ]
Get the likes for the authenticated user @param options the options for this call (or null) @return a List of posts
[ "Get", "the", "likes", "for", "the", "authenticated", "user" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L258-L260
101,563
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.blogAvatar
public String blogAvatar(String blogName, Integer size) { String pathExt = size == null ? "" : "/" + size.toString(); return requestBuilder.getRedirectUrl(JumblrClient.blogPath(blogName, "/avatar" + pathExt)); }
java
public String blogAvatar(String blogName, Integer size) { String pathExt = size == null ? "" : "/" + size.toString(); return requestBuilder.getRedirectUrl(JumblrClient.blogPath(blogName, "/avatar" + pathExt)); }
[ "public", "String", "blogAvatar", "(", "String", "blogName", ",", "Integer", "size", ")", "{", "String", "pathExt", "=", "size", "==", "null", "?", "\"\"", ":", "\"/\"", "+", "size", ".", "toString", "(", ")", ";", "return", "requestBuilder", ".", "getRe...
Get a specific size avatar for a given blog @param blogName the avatar URL of the blog @param size The size requested @return a string representing the URL of the avatar
[ "Get", "a", "specific", "size", "avatar", "for", "a", "given", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L272-L275
101,564
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.like
public void like(Long postId, String reblogKey) { Map<String, String> map = new HashMap<String, String>(); map.put("id", postId.toString()); map.put("reblog_key", reblogKey); requestBuilder.post("/user/like", map); }
java
public void like(Long postId, String reblogKey) { Map<String, String> map = new HashMap<String, String>(); map.put("id", postId.toString()); map.put("reblog_key", reblogKey); requestBuilder.post("/user/like", map); }
[ "public", "void", "like", "(", "Long", "postId", ",", "String", "reblogKey", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"id\"", ",", ...
Like a given post @param postId the ID of the post to like @param reblogKey The reblog key for the post
[ "Like", "a", "given", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L284-L289
101,565
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.follow
public void follow(String blogName) { Map<String, String> map = new HashMap<String, String>(); map.put("url", JumblrClient.blogUrl(blogName)); requestBuilder.post("/user/follow", map); }
java
public void follow(String blogName) { Map<String, String> map = new HashMap<String, String>(); map.put("url", JumblrClient.blogUrl(blogName)); requestBuilder.post("/user/follow", map); }
[ "public", "void", "follow", "(", "String", "blogName", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"url\"", ",", "JumblrClient", ".", ...
Follow a given blog @param blogName The name of the blog to follow
[ "Follow", "a", "given", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L307-L311
101,566
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.postDelete
public void postDelete(String blogName, Long postId) { Map<String, String> map = new HashMap<String, String>(); map.put("id", postId.toString()); requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map); }
java
public void postDelete(String blogName, Long postId) { Map<String, String> map = new HashMap<String, String>(); map.put("id", postId.toString()); requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map); }
[ "public", "void", "postDelete", "(", "String", "blogName", ",", "Long", "postId", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"id\"", ...
Delete a given post @param blogName the name of the blog the post is in @param postId the id of the post to delete
[ "Delete", "a", "given", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L328-L332
101,567
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.postEdit
public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException { Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail); sdetail.put("id", id); requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail); }
java
public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException { Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail); sdetail.put("id", id); requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail); }
[ "public", "void", "postEdit", "(", "String", "blogName", ",", "Long", "id", ",", "Map", "<", "String", ",", "?", ">", "detail", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Object", ">", "sdetail", "=", "JumblrClient", ".", "safeOptionM...
Save edits for a given post @param blogName The blog name of the post @param id the Post id @param detail The detail to save @throws IOException if any file specified in detail cannot be read
[ "Save", "edits", "for", "a", "given", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L371-L375
101,568
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.postCreate
public Long postCreate(String blogName, Map<String, ?> detail) throws IOException { return requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post"), detail).getId(); }
java
public Long postCreate(String blogName, Map<String, ?> detail) throws IOException { return requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post"), detail).getId(); }
[ "public", "Long", "postCreate", "(", "String", "blogName", ",", "Map", "<", "String", ",", "?", ">", "detail", ")", "throws", "IOException", "{", "return", "requestBuilder", ".", "postMultipart", "(", "JumblrClient", ".", "blogPath", "(", "blogName", ",", "\...
Create a post @param blogName The blog name for the post @param detail the detail to save @return Long the created post's id @throws IOException if any file specified in detail cannot be read
[ "Create", "a", "post" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L384-L386
101,569
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.newPost
public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException { T post = klass.newInstance(); post.setClient(this); post.setBlogName(blogName); return post; }
java
public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException { T post = klass.newInstance(); post.setClient(this); post.setBlogName(blogName); return post; }
[ "public", "<", "T", "extends", "Post", ">", "T", "newPost", "(", "String", "blogName", ",", "Class", "<", "T", ">", "klass", ")", "throws", "IllegalAccessException", ",", "InstantiationException", "{", "T", "post", "=", "klass", ".", "newInstance", "(", ")...
Set up a new post of a given type @param blogName the name of the blog for this post (or null) @param klass the type of Post to instantiate @param <T> the type of Post to instantiate @return the new post with the client set @throws IllegalAccessException if class instantiation fails @throws InstantiationException if cl...
[ "Set", "up", "a", "new", "post", "of", "a", "given", "type" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L397-L402
101,570
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Blog.java
Blog.followers
public List<User> followers(Map<String, ?> options) { return client.blogFollowers(this.name, options); }
java
public List<User> followers(Map<String, ?> options) { return client.blogFollowers(this.name, options); }
[ "public", "List", "<", "User", ">", "followers", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "client", ".", "blogFollowers", "(", "this", ".", "name", ",", "options", ")", ";", "}" ]
Get followers for this blog @param options a map of options (or null) @return A List of users
[ "Get", "followers", "for", "this", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L105-L107
101,571
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Blog.java
Blog.posts
public List<Post> posts(Map<String, ?> options) { return client.blogPosts(name, options); }
java
public List<Post> posts(Map<String, ?> options) { return client.blogPosts(name, options); }
[ "public", "List", "<", "Post", ">", "posts", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "client", ".", "blogPosts", "(", "name", ",", "options", ")", ";", "}" ]
Get the posts for this blog @param options a map of options (or null) @return A List of posts
[ "Get", "the", "posts", "for", "this", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L116-L118
101,572
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Blog.java
Blog.likedPosts
public List<Post> likedPosts(Map<String, ?> options) { return client.blogLikes(this.name, options); }
java
public List<Post> likedPosts(Map<String, ?> options) { return client.blogLikes(this.name, options); }
[ "public", "List", "<", "Post", ">", "likedPosts", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "client", ".", "blogLikes", "(", "this", ".", "name", ",", "options", ")", ";", "}" ]
Get likes posts for this blog @param options a map of options (or null) @return A List of posts
[ "Get", "likes", "posts", "for", "this", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L138-L140
101,573
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Blog.java
Blog.queuedPosts
public List<Post> queuedPosts(Map<String, ?> options) { return client.blogQueuedPosts(name, options); }
java
public List<Post> queuedPosts(Map<String, ?> options) { return client.blogQueuedPosts(name, options); }
[ "public", "List", "<", "Post", ">", "queuedPosts", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "client", ".", "blogQueuedPosts", "(", "name", ",", "options", ")", ";", "}" ]
Get the queued posts for this blog @param options the options (or null) @return a List of posts
[ "Get", "the", "queued", "posts", "for", "this", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L163-L165
101,574
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Blog.java
Blog.draftPosts
public List<Post> draftPosts(Map<String, ?> options) { return client.blogDraftPosts(name, options); }
java
public List<Post> draftPosts(Map<String, ?> options) { return client.blogDraftPosts(name, options); }
[ "public", "List", "<", "Post", ">", "draftPosts", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "client", ".", "blogDraftPosts", "(", "name", ",", "options", ")", ";", "}" ]
Get the draft posts for this blog @param options the options (or null) @return a List of posts
[ "Get", "the", "draft", "posts", "for", "this", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L176-L178
101,575
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Blog.java
Blog.submissions
public List<Post> submissions(Map<String, ?> options) { return client.blogSubmissions(name, options); }
java
public List<Post> submissions(Map<String, ?> options) { return client.blogSubmissions(name, options); }
[ "public", "List", "<", "Post", ">", "submissions", "(", "Map", "<", "String", ",", "?", ">", "options", ")", "{", "return", "client", ".", "blogSubmissions", "(", "name", ",", "options", ")", ";", "}" ]
Get the submissions for this blog @param options the options (or null) @return a List of posts
[ "Get", "the", "submissions", "for", "this", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L189-L191
101,576
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Blog.java
Blog.newPost
public <T extends Post> T newPost(Class<T> klass) throws IllegalAccessException, InstantiationException { return client.newPost(name, klass); }
java
public <T extends Post> T newPost(Class<T> klass) throws IllegalAccessException, InstantiationException { return client.newPost(name, klass); }
[ "public", "<", "T", "extends", "Post", ">", "T", "newPost", "(", "Class", "<", "T", ">", "klass", ")", "throws", "IllegalAccessException", ",", "InstantiationException", "{", "return", "client", ".", "newPost", "(", "name", ",", "klass", ")", ";", "}" ]
Create a new post of a given type for this blog @param klass the class of the post to make @param <T> the class of the post to make @return new post @throws IllegalAccessException if class instantiation fails @throws InstantiationException if class instantiation fails
[ "Create", "a", "new", "post", "of", "a", "given", "type", "for", "this", "blog" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Blog.java#L205-L207
101,577
tumblr/jumblr
src/main/java/com/tumblr/jumblr/types/Photo.java
Photo.getType
public PhotoType getType() { if (this.source != null) { return PhotoType.SOURCE; } if (this.file != null) { return PhotoType.FILE; } return null; }
java
public PhotoType getType() { if (this.source != null) { return PhotoType.SOURCE; } if (this.file != null) { return PhotoType.FILE; } return null; }
[ "public", "PhotoType", "getType", "(", ")", "{", "if", "(", "this", ".", "source", "!=", "null", ")", "{", "return", "PhotoType", ".", "SOURCE", ";", "}", "if", "(", "this", ".", "file", "!=", "null", ")", "{", "return", "PhotoType", ".", "FILE", "...
Get the type of this photo @return PhotoType the type of photo
[ "Get", "the", "type", "of", "this", "photo" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/types/Photo.java#L56-L60
101,578
tumblr/jumblr
src/main/java/com/tumblr/jumblr/request/RequestBuilder.java
RequestBuilder.postXAuth
public Token postXAuth(final String email, final String password) { OAuthRequest request = constructXAuthPost(email, password); setToken("", ""); // Empty token is required for Scribe to execute XAuth. sign(request); return clearXAuth(request.send()); }
java
public Token postXAuth(final String email, final String password) { OAuthRequest request = constructXAuthPost(email, password); setToken("", ""); // Empty token is required for Scribe to execute XAuth. sign(request); return clearXAuth(request.send()); }
[ "public", "Token", "postXAuth", "(", "final", "String", "email", ",", "final", "String", "password", ")", "{", "OAuthRequest", "request", "=", "constructXAuthPost", "(", "email", ",", "password", ")", ";", "setToken", "(", "\"\"", ",", "\"\"", ")", ";", "/...
Posts an XAuth request. A new method is needed because the response from the server is not a standard Tumblr JSON response. @param email the user's login email. @param password the user's password. @return the login token.
[ "Posts", "an", "XAuth", "request", ".", "A", "new", "method", "is", "needed", "because", "the", "response", "from", "the", "server", "is", "not", "a", "standard", "Tumblr", "JSON", "response", "." ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/request/RequestBuilder.java#L74-L79
101,579
tumblr/jumblr
src/main/java/com/tumblr/jumblr/request/RequestBuilder.java
RequestBuilder.constructXAuthPost
private OAuthRequest constructXAuthPost(String email, String password) { OAuthRequest request = new OAuthRequest(Verb.POST, xauthEndpoint); request.addBodyParameter("x_auth_username", email); request.addBodyParameter("x_auth_password", password); request.addBodyParameter("x_auth_mode", "...
java
private OAuthRequest constructXAuthPost(String email, String password) { OAuthRequest request = new OAuthRequest(Verb.POST, xauthEndpoint); request.addBodyParameter("x_auth_username", email); request.addBodyParameter("x_auth_password", password); request.addBodyParameter("x_auth_mode", "...
[ "private", "OAuthRequest", "constructXAuthPost", "(", "String", "email", ",", "String", "password", ")", "{", "OAuthRequest", "request", "=", "new", "OAuthRequest", "(", "Verb", ".", "POST", ",", "xauthEndpoint", ")", ";", "request", ".", "addBodyParameter", "("...
Construct an XAuth request
[ "Construct", "an", "XAuth", "request" ]
373629fd545defb016e227ea758f092507fbd624
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/request/RequestBuilder.java#L82-L88
101,580
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.getType
public LazyType getType(int index) throws LazyException{ LazyNode token=getValueToken(index); switch(token.type){ case LazyNode.OBJECT: return LazyType.OBJECT; case LazyNode.ARRAY: return LazyType.ARRAY; case LazyNode.VALUE_TRUE: return LazyType.BOOLEAN; case LazyNode.VALUE_FALSE: return LazyType.BOOLEA...
java
public LazyType getType(int index) throws LazyException{ LazyNode token=getValueToken(index); switch(token.type){ case LazyNode.OBJECT: return LazyType.OBJECT; case LazyNode.ARRAY: return LazyType.ARRAY; case LazyNode.VALUE_TRUE: return LazyType.BOOLEAN; case LazyNode.VALUE_FALSE: return LazyType.BOOLEA...
[ "public", "LazyType", "getType", "(", "int", "index", ")", "throws", "LazyException", "{", "LazyNode", "token", "=", "getValueToken", "(", "index", ")", ";", "switch", "(", "token", ".", "type", ")", "{", "case", "LazyNode", ".", "OBJECT", ":", "return", ...
Returns the value type of the given field. @param index the requested field @return the type of the value for the given index @throws LazyException if the requested index did not exist
[ "Returns", "the", "value", "type", "of", "the", "given", "field", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L124-L138
101,581
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.getBoolean
public boolean getBoolean(int index){ LazyNode token=getValueToken(index); if(token.type==LazyNode.VALUE_TRUE)return true; if(token.type==LazyNode.VALUE_FALSE)return false; throw new LazyException("Requested value is not a boolean",token); }
java
public boolean getBoolean(int index){ LazyNode token=getValueToken(index); if(token.type==LazyNode.VALUE_TRUE)return true; if(token.type==LazyNode.VALUE_FALSE)return false; throw new LazyException("Requested value is not a boolean",token); }
[ "public", "boolean", "getBoolean", "(", "int", "index", ")", "{", "LazyNode", "token", "=", "getValueToken", "(", "index", ")", ";", "if", "(", "token", ".", "type", "==", "LazyNode", ".", "VALUE_TRUE", ")", "return", "true", ";", "if", "(", "token", "...
Returns the boolean value stored at the given index. @param index the location of the value in this array @return the value if it could be parsed as a boolean @throws LazyException if the index is out of bounds
[ "Returns", "the", "boolean", "value", "stored", "at", "the", "given", "index", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L500-L505
101,582
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.optBoolean
public boolean optBoolean(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return false; if(token.type==LazyNode.VALUE_NULL)return false; if(token.type==LazyNode.VALUE_TRUE)return true; if(token.type==LazyNode.VALUE_FALSE)return false; throw new LazyException("Requested value is not a...
java
public boolean optBoolean(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return false; if(token.type==LazyNode.VALUE_NULL)return false; if(token.type==LazyNode.VALUE_TRUE)return true; if(token.type==LazyNode.VALUE_FALSE)return false; throw new LazyException("Requested value is not a...
[ "public", "boolean", "optBoolean", "(", "int", "index", ")", "{", "LazyNode", "token", "=", "getOptionalValueToken", "(", "index", ")", ";", "if", "(", "token", "==", "null", ")", "return", "false", ";", "if", "(", "token", ".", "type", "==", "LazyNode",...
Returns the boolean value stored at the given index or null if there was no such value. @param index the location of the value in this array @return the value if it could be parsed as a boolean or null if there was no such value @throws LazyException if the index is out of bounds
[ "Returns", "the", "boolean", "value", "stored", "at", "the", "given", "index", "or", "null", "if", "there", "was", "no", "such", "value", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L514-L521
101,583
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.getString
public String getString(int index) throws LazyException{ LazyNode token=getValueToken(index); return token.getStringValue(); }
java
public String getString(int index) throws LazyException{ LazyNode token=getValueToken(index); return token.getStringValue(); }
[ "public", "String", "getString", "(", "int", "index", ")", "throws", "LazyException", "{", "LazyNode", "token", "=", "getValueToken", "(", "index", ")", ";", "return", "token", ".", "getStringValue", "(", ")", ";", "}" ]
Returns the string value stored at the given index. @param index the location of the value in this array @return the value if it could be parsed as a string @throws LazyException if the index is out of bounds
[ "Returns", "the", "string", "value", "stored", "at", "the", "given", "index", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L547-L550
101,584
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.optString
public String optString(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return null; if(token.type==LazyNode.VALUE_NULL)return null; return token.getStringValue(); }
java
public String optString(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return null; if(token.type==LazyNode.VALUE_NULL)return null; return token.getStringValue(); }
[ "public", "String", "optString", "(", "int", "index", ")", "{", "LazyNode", "token", "=", "getOptionalValueToken", "(", "index", ")", ";", "if", "(", "token", "==", "null", ")", "return", "null", ";", "if", "(", "token", ".", "type", "==", "LazyNode", ...
Returns the string value stored at the given index or null if there was no such value. @param index the location of the value in this array @return the value if it could be parsed as a boolean or null if there was no such value @throws LazyException if the index is out of bounds
[ "Returns", "the", "string", "value", "stored", "at", "the", "given", "index", "or", "null", "if", "there", "was", "no", "such", "value", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L559-L564
101,585
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.optInt
public int optInt(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return 0; if(token.type==LazyNode.VALUE_NULL)return 0; return token.getIntValue(); }
java
public int optInt(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return 0; if(token.type==LazyNode.VALUE_NULL)return 0; return token.getIntValue(); }
[ "public", "int", "optInt", "(", "int", "index", ")", "{", "LazyNode", "token", "=", "getOptionalValueToken", "(", "index", ")", ";", "if", "(", "token", "==", "null", ")", "return", "0", ";", "if", "(", "token", ".", "type", "==", "LazyNode", ".", "V...
Returns the int value stored at the given index or 0 if there was no such value. @param index the location of the value in this array @return the value if it could be parsed as a boolean or null if there was no such value @throws LazyException if the index is out of bounds
[ "Returns", "the", "int", "value", "stored", "at", "the", "given", "index", "or", "0", "if", "there", "was", "no", "such", "value", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L600-L605
101,586
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.optLong
public long optLong(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return 0l; if(token.type==LazyNode.VALUE_NULL)return 0l; return token.getLongValue(); }
java
public long optLong(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return 0l; if(token.type==LazyNode.VALUE_NULL)return 0l; return token.getLongValue(); }
[ "public", "long", "optLong", "(", "int", "index", ")", "{", "LazyNode", "token", "=", "getOptionalValueToken", "(", "index", ")", ";", "if", "(", "token", "==", "null", ")", "return", "0l", ";", "if", "(", "token", ".", "type", "==", "LazyNode", ".", ...
Returns the long value stored at the given index or 0 if there was no such value. @param index the location of the value in this array @return the value if it could be parsed as a boolean or null if there was no such value @throws LazyException if the index is out of bounds
[ "Returns", "the", "long", "value", "stored", "at", "the", "given", "index", "or", "0", "if", "there", "was", "no", "such", "value", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L641-L646
101,587
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.optDouble
public double optDouble(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return 0.0; if(token.type==LazyNode.VALUE_NULL)return 0.0; return token.getDoubleValue(); }
java
public double optDouble(int index){ LazyNode token=getOptionalValueToken(index); if(token==null)return 0.0; if(token.type==LazyNode.VALUE_NULL)return 0.0; return token.getDoubleValue(); }
[ "public", "double", "optDouble", "(", "int", "index", ")", "{", "LazyNode", "token", "=", "getOptionalValueToken", "(", "index", ")", ";", "if", "(", "token", "==", "null", ")", "return", "0.0", ";", "if", "(", "token", ".", "type", "==", "LazyNode", "...
Returns the double value stored at the given index or 0.0 if there was no such value. @param index the location of the value in this array @return the value if it could be parsed as a boolean or null if there was no such value @throws LazyException if the index is out of bounds
[ "Returns", "the", "double", "value", "stored", "at", "the", "given", "index", "or", "0", ".", "0", "if", "there", "was", "no", "such", "value", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L682-L687
101,588
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.isNull
public boolean isNull(int index) throws LazyException{ LazyNode token=getValueToken(index); if(token.type==LazyNode.VALUE_NULL)return true; return false; }
java
public boolean isNull(int index) throws LazyException{ LazyNode token=getValueToken(index); if(token.type==LazyNode.VALUE_NULL)return true; return false; }
[ "public", "boolean", "isNull", "(", "int", "index", ")", "throws", "LazyException", "{", "LazyNode", "token", "=", "getValueToken", "(", "index", ")", ";", "if", "(", "token", ".", "type", "==", "LazyNode", ".", "VALUE_NULL", ")", "return", "true", ";", ...
Returns true if the value stored at the given index is null. @param index the location of the value in this array @return true if the value is null, false otherwise @throws LazyException if the index is out of bounds
[ "Returns", "true", "if", "the", "value", "stored", "at", "the", "given", "index", "is", "null", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L711-L715
101,589
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyArray.java
LazyArray.getOptionalValueToken
private LazyNode getOptionalValueToken(int index) throws LazyException{ if(index<0)throw new LazyException("Array undex can not be negative"); int num=0; LazyNode child=root.child; // If the value we are looking for is past our previous traversal point // continue at the previous point if(selectInt>-1 && in...
java
private LazyNode getOptionalValueToken(int index) throws LazyException{ if(index<0)throw new LazyException("Array undex can not be negative"); int num=0; LazyNode child=root.child; // If the value we are looking for is past our previous traversal point // continue at the previous point if(selectInt>-1 && in...
[ "private", "LazyNode", "getOptionalValueToken", "(", "int", "index", ")", "throws", "LazyException", "{", "if", "(", "index", "<", "0", ")", "throw", "new", "LazyException", "(", "\"Array undex can not be negative\"", ")", ";", "int", "num", "=", "0", ";", "La...
Values for an array are attached as children on the token representing the array itself. This method finds the correct child for a given index and returns it. Since children are stored as a linked list, this method is likely to be a serious O(n) performance bottleneck for array access. To improve this for the most com...
[ "Values", "for", "an", "array", "are", "attached", "as", "children", "on", "the", "token", "representing", "the", "array", "itself", ".", "This", "method", "finds", "the", "correct", "child", "for", "a", "given", "index", "and", "returns", "it", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L770-L791
101,590
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyParser.java
LazyParser.push
private void push(final LazyNode token){ stackTop.addChild(token); // The stack allocation strategy here is to increase it in increments // of a power of two. This lets us check when all low bits are set and // its time to increase the stack again. // This lets us do a compare between a constant and a variabl...
java
private void push(final LazyNode token){ stackTop.addChild(token); // The stack allocation strategy here is to increase it in increments // of a power of two. This lets us check when all low bits are set and // its time to increase the stack again. // This lets us do a compare between a constant and a variabl...
[ "private", "void", "push", "(", "final", "LazyNode", "token", ")", "{", "stackTop", ".", "addChild", "(", "token", ")", ";", "// The stack allocation strategy here is to increase it in increments", "// of a power of two. This lets us check when all low bits are set and", "// its ...
Push a token onto the stack and attach it to the previous top as a child
[ "Push", "a", "token", "onto", "the", "stack", "and", "attach", "it", "to", "the", "previous", "top", "as", "a", "child" ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L59-L74
101,591
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyParser.java
LazyParser.pop
private LazyNode pop(){ LazyNode value=stackTop; stackPointer--; if(stackPointer>0){ stackTop=stack[stackPointer-1]; } return value; }
java
private LazyNode pop(){ LazyNode value=stackTop; stackPointer--; if(stackPointer>0){ stackTop=stack[stackPointer-1]; } return value; }
[ "private", "LazyNode", "pop", "(", ")", "{", "LazyNode", "value", "=", "stackTop", ";", "stackPointer", "--", ";", "if", "(", "stackPointer", ">", "0", ")", "{", "stackTop", "=", "stack", "[", "stackPointer", "-", "1", "]", ";", "}", "return", "value",...
Pop a token off the stack and reset the stackTop pointer
[ "Pop", "a", "token", "off", "the", "stack", "and", "reset", "the", "stackTop", "pointer" ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L77-L84
101,592
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyParser.java
LazyParser.consumeWhiteSpace
private final void consumeWhiteSpace(){ char c=cbuf[n]; while(c==CH_SPACE|| c==CH_LINEFEED || c==CH_TAB || c==CH_CARRIAGE_RETURN){ n++; c=cbuf[n]; } }
java
private final void consumeWhiteSpace(){ char c=cbuf[n]; while(c==CH_SPACE|| c==CH_LINEFEED || c==CH_TAB || c==CH_CARRIAGE_RETURN){ n++; c=cbuf[n]; } }
[ "private", "final", "void", "consumeWhiteSpace", "(", ")", "{", "char", "c", "=", "cbuf", "[", "n", "]", ";", "while", "(", "c", "==", "CH_SPACE", "||", "c", "==", "CH_LINEFEED", "||", "c", "==", "CH_TAB", "||", "c", "==", "CH_CARRIAGE_RETURN", ")", ...
Utility method to consume sections of whitespace
[ "Utility", "method", "to", "consume", "sections", "of", "whitespace" ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L97-L103
101,593
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyParser.java
LazyParser.consumeString
private final boolean consumeString() throws LazyException{ boolean escaped=false; n++; char c=cbuf[n]; while(c!=CH_QUOTE){ if(c==CH_BACKSLASH){ n++; c=cbuf[n]; if(!(c==CH_QUOTE || c==CH_BACKSLASH || c==CH_SLASH || c==CH_b || c==CH_f || c==CH_n || c==CH_r || c==CH_t || c==CH_u)){ throw new L...
java
private final boolean consumeString() throws LazyException{ boolean escaped=false; n++; char c=cbuf[n]; while(c!=CH_QUOTE){ if(c==CH_BACKSLASH){ n++; c=cbuf[n]; if(!(c==CH_QUOTE || c==CH_BACKSLASH || c==CH_SLASH || c==CH_b || c==CH_f || c==CH_n || c==CH_r || c==CH_t || c==CH_u)){ throw new L...
[ "private", "final", "boolean", "consumeString", "(", ")", "throws", "LazyException", "{", "boolean", "escaped", "=", "false", ";", "n", "++", ";", "char", "c", "=", "cbuf", "[", "n", "]", ";", "while", "(", "c", "!=", "CH_QUOTE", ")", "{", "if", "(",...
element if an escape character is found
[ "element", "if", "an", "escape", "character", "is", "found" ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L116-L133
101,594
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyParser.java
LazyParser.consumeNumber
private final boolean consumeNumber(char c) throws LazyException{ boolean floatChar=false; if(c==CH_DASH){ // If the number started with a minus sign it must be followed by at least one digit n++; c=cbuf[n]; if(c<CH_0 || c>CH_9){ throw new LazyException("Digit expected",n); } } n++; if(c==C...
java
private final boolean consumeNumber(char c) throws LazyException{ boolean floatChar=false; if(c==CH_DASH){ // If the number started with a minus sign it must be followed by at least one digit n++; c=cbuf[n]; if(c<CH_0 || c>CH_9){ throw new LazyException("Digit expected",n); } } n++; if(c==C...
[ "private", "final", "boolean", "consumeNumber", "(", "char", "c", ")", "throws", "LazyException", "{", "boolean", "floatChar", "=", "false", ";", "if", "(", "c", "==", "CH_DASH", ")", "{", "// If the number started with a minus sign it must be followed by at least one d...
of the number does not validate correctly
[ "of", "the", "number", "does", "not", "validate", "correctly" ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyParser.java#L137-L198
101,595
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java
DictionaryCache.init
private void init(){ // We are going to use a linked hash map to maintain our sliding window slidingWindow=new LinkedHashMap<String,Integer>(windowSize+1, .75F, false){ protected boolean removeEldestEntry(Map.Entry<String,Integer> eldest){ return size()>windowSize; ...
java
private void init(){ // We are going to use a linked hash map to maintain our sliding window slidingWindow=new LinkedHashMap<String,Integer>(windowSize+1, .75F, false){ protected boolean removeEldestEntry(Map.Entry<String,Integer> eldest){ return size()>windowSize; ...
[ "private", "void", "init", "(", ")", "{", "// We are going to use a linked hash map to maintain our sliding window", "slidingWindow", "=", "new", "LinkedHashMap", "<", "String", ",", "Integer", ">", "(", "windowSize", "+", "1", ",", ".75F", ",", "false", ")", "{", ...
Initializes the internal sliding window data structure.
[ "Initializes", "the", "internal", "sliding", "window", "data", "structure", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java#L36-L43
101,596
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java
DictionaryCache.get
public String get(short index){ if(index<0)return null; if(index>=next)return null; return data[index]; }
java
public String get(short index){ if(index<0)return null; if(index>=next)return null; return data[index]; }
[ "public", "String", "get", "(", "short", "index", ")", "{", "if", "(", "index", "<", "0", ")", "return", "null", ";", "if", "(", "index", ">=", "next", ")", "return", "null", ";", "return", "data", "[", "index", "]", ";", "}" ]
Returns the value held at a specific location in the dictionary. @param index the value to look up @return the value from the dictionary or null if no such value exists
[ "Returns", "the", "value", "held", "at", "a", "specific", "location", "in", "the", "dictionary", "." ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java#L116-L120
101,597
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java
DictionaryCache.put
public short put(String value){ // Do we already have this value? if(dataMap.containsKey(value)){ dictionaryHit++; return dataMap.get(value); } // Are we filled up? if(next==MAX_SIZE){ dictionaryMiss++; return -1; } // Should we add values without actual repetitions? if(minRepetitions==0){ ...
java
public short put(String value){ // Do we already have this value? if(dataMap.containsKey(value)){ dictionaryHit++; return dataMap.get(value); } // Are we filled up? if(next==MAX_SIZE){ dictionaryMiss++; return -1; } // Should we add values without actual repetitions? if(minRepetitions==0){ ...
[ "public", "short", "put", "(", "String", "value", ")", "{", "// Do we already have this value?", "if", "(", "dataMap", ".", "containsKey", "(", "value", ")", ")", "{", "dictionaryHit", "++", ";", "return", "dataMap", ".", "get", "(", "value", ")", ";", "}"...
Add a new value to the dictionary if we have seen it a certain number of times within the current sliding window. If not, return -1 and mark that we saw it. If the value is already in the dictionary, just return the lookup position. @param value the value to add @return the index of the value in the dictionary of -1 i...
[ "Add", "a", "new", "value", "to", "the", "dictionary", "if", "we", "have", "seen", "it", "a", "certain", "number", "of", "times", "within", "the", "current", "sliding", "window", ".", "If", "not", "return", "-", "1", "and", "mark", "that", "we", "saw",...
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/compressor/DictionaryCache.java#L145-L184
101,598
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyNode.java
LazyNode.addChild
protected void addChild(LazyNode token){ // If no children have been added yet, lastChild will be null if(lastChild==null){ child=token; lastChild=token; return; } // Set the next pointer on the current end of the child list and set last child to the given token lastChild.next=token; lastChild=toke...
java
protected void addChild(LazyNode token){ // If no children have been added yet, lastChild will be null if(lastChild==null){ child=token; lastChild=token; return; } // Set the next pointer on the current end of the child list and set last child to the given token lastChild.next=token; lastChild=toke...
[ "protected", "void", "addChild", "(", "LazyNode", "token", ")", "{", "// If no children have been added yet, lastChild will be null", "if", "(", "lastChild", "==", "null", ")", "{", "child", "=", "token", ";", "lastChild", "=", "token", ";", "return", ";", "}", ...
Add a new child to the current linked list of child tokens @param token the child to add
[ "Add", "a", "new", "child", "to", "the", "current", "linked", "list", "of", "child", "tokens" ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L100-L110
101,599
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyNode.java
LazyNode.getChildCount
protected int getChildCount(){ int num=0; LazyNode token=child; while(token!=null){ num++; token=token.next; } return num; }
java
protected int getChildCount(){ int num=0; LazyNode token=child; while(token!=null){ num++; token=token.next; } return num; }
[ "protected", "int", "getChildCount", "(", ")", "{", "int", "num", "=", "0", ";", "LazyNode", "token", "=", "child", ";", "while", "(", "token", "!=", "null", ")", "{", "num", "++", ";", "token", "=", "token", ".", "next", ";", "}", "return", "num",...
Count the children attached to this token. Be aware that this requires actual linked list traversal! @return the number of child tokens attached to this token
[ "Count", "the", "children", "attached", "to", "this", "token", ".", "Be", "aware", "that", "this", "requires", "actual", "linked", "list", "traversal!" ]
1a223f57fc0cb9941bc175739697ac95da5618cc
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L117-L125