repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
---|---|---|---|---|---|---|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/analysis/AnalyzerModule.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/TokenMapper.java
// public interface TokenMapper {
// public int getTermId(String str, boolean dontGenerateNewIds);
//
// public void setBloomFilter(BloomFilter<String> bloomFilter);
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/TokenMapperImpl.java
// public class TokenMapperImpl implements TokenMapper {
// protected int termIdSequence;
// protected final TObjectIntHashMap<String> termMap = new TObjectIntHashMap<String>();
// protected BloomFilter<String> bloomFilter;
//
// public TokenMapperImpl() {
// termIdSequence = 1;
// bloomFilter = new FakeBloomFilter<String>();
// }
//
// @Override
// public int getTermId(String str, boolean dontGenerateNewIds) {
// int termId = 0;
// if (bloomFilter.contains(str)) {
// termId = termMap.get(str);
// }
// if (termId == 0 && !dontGenerateNewIds) {
// synchronized (this) {
// termId = getNewTermId();
// termMap.put(str, termId);
// bloomFilter.add(str);
// }
// }
// return termId;
// }
//
// @Override
// public void setBloomFilter(BloomFilter<String> bloomFilter) {
// this.bloomFilter = bloomFilter;
// }
//
// public int getNewTermId() {
// return termIdSequence++;
// }
// }
|
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import de.danielbasedow.prospecter.core.TokenMapper;
import de.danielbasedow.prospecter.core.TokenMapperImpl;
|
package de.danielbasedow.prospecter.core.analysis;
public class AnalyzerModule extends AbstractModule {
@Override
protected void configure() {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/TokenMapper.java
// public interface TokenMapper {
// public int getTermId(String str, boolean dontGenerateNewIds);
//
// public void setBloomFilter(BloomFilter<String> bloomFilter);
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/TokenMapperImpl.java
// public class TokenMapperImpl implements TokenMapper {
// protected int termIdSequence;
// protected final TObjectIntHashMap<String> termMap = new TObjectIntHashMap<String>();
// protected BloomFilter<String> bloomFilter;
//
// public TokenMapperImpl() {
// termIdSequence = 1;
// bloomFilter = new FakeBloomFilter<String>();
// }
//
// @Override
// public int getTermId(String str, boolean dontGenerateNewIds) {
// int termId = 0;
// if (bloomFilter.contains(str)) {
// termId = termMap.get(str);
// }
// if (termId == 0 && !dontGenerateNewIds) {
// synchronized (this) {
// termId = getNewTermId();
// termMap.put(str, termId);
// bloomFilter.add(str);
// }
// }
// return termId;
// }
//
// @Override
// public void setBloomFilter(BloomFilter<String> bloomFilter) {
// this.bloomFilter = bloomFilter;
// }
//
// public int getNewTermId() {
// return termIdSequence++;
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/analysis/AnalyzerModule.java
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import de.danielbasedow.prospecter.core.TokenMapper;
import de.danielbasedow.prospecter.core.TokenMapperImpl;
package de.danielbasedow.prospecter.core.analysis;
public class AnalyzerModule extends AbstractModule {
@Override
protected void configure() {
|
bind(TokenMapper.class).to(TokenMapperImpl.class).in(Singleton.class);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/StringIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
|
package de.danielbasedow.prospecter.core.index;
public class StringIndex extends AbstractFieldIndex {
protected final Map<String, TLongList> index = new ConcurrentHashMap<String, TLongList>();
public StringIndex(String name) {
super(name);
}
@Override
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/StringIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
package de.danielbasedow.prospecter.core.index;
public class StringIndex extends AbstractFieldIndex {
protected final Map<String, TLongList> index = new ConcurrentHashMap<String, TLongList>();
public StringIndex(String name) {
super(name);
}
@Override
|
public void match(Field field, Matcher matcher) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/StringIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
|
package de.danielbasedow.prospecter.core.index;
public class StringIndex extends AbstractFieldIndex {
protected final Map<String, TLongList> index = new ConcurrentHashMap<String, TLongList>();
public StringIndex(String name) {
super(name);
}
@Override
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/StringIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
package de.danielbasedow.prospecter.core.index;
public class StringIndex extends AbstractFieldIndex {
protected final Map<String, TLongList> index = new ConcurrentHashMap<String, TLongList>();
public StringIndex(String name) {
super(name);
}
@Override
|
public void match(Field field, Matcher matcher) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/StringIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
|
package de.danielbasedow.prospecter.core.index;
public class StringIndex extends AbstractFieldIndex {
protected final Map<String, TLongList> index = new ConcurrentHashMap<String, TLongList>();
public StringIndex(String name) {
super(name);
}
@Override
public void match(Field field, Matcher matcher) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/StringIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
package de.danielbasedow.prospecter.core.index;
public class StringIndex extends AbstractFieldIndex {
protected final Map<String, TLongList> index = new ConcurrentHashMap<String, TLongList>();
public StringIndex(String name) {
super(name);
}
@Override
public void match(Field field, Matcher matcher) {
|
List<Token> tokens = field.getTokens();
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
|
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
|
FullTextIndex ft = new FullTextIndex("_all", null);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
|
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
|
ft.addPosting(new Token<Integer>(1, MatchCondition.EQUALS), QueryPosting.pack(1, 1, false));
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
|
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
ft.addPosting(new Token<Integer>(1, MatchCondition.EQUALS), QueryPosting.pack(1, 1, false));
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
ft.addPosting(new Token<Integer>(1, MatchCondition.EQUALS), QueryPosting.pack(1, 1, false));
|
Matcher m = new Matcher(new QueryManager());
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
|
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
ft.addPosting(new Token<Integer>(1, MatchCondition.EQUALS), QueryPosting.pack(1, 1, false));
Matcher m = new Matcher(new QueryManager());
ArrayList<Token> tokens = new ArrayList<Token>();
tokens.add(new Token<Integer>(1, MatchCondition.EQUALS));
|
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/MatcherTest.java
import de.danielbasedow.prospecter.core.document.Field;
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
import java.util.ArrayList;
package de.danielbasedow.prospecter.core;
public class MatcherTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
ft.addPosting(new Token<Integer>(1, MatchCondition.EQUALS), QueryPosting.pack(1, 1, false));
Matcher m = new Matcher(new QueryManager());
ArrayList<Token> tokens = new ArrayList<Token>();
tokens.add(new Token<Integer>(1, MatchCondition.EQUALS));
|
ft.match(new Field("_all", tokens), m);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/TokenMapper.java
|
// Path: src/main/java/com/skjegstad/utils/BloomFilter.java
// public interface BloomFilter<T> {
// public void add(T element);
//
// public void add(byte[] element);
//
// public boolean contains(T element);
//
// public boolean contains(byte[] element);
// }
|
import com.skjegstad.utils.BloomFilter;
|
package de.danielbasedow.prospecter.core;
public interface TokenMapper {
public int getTermId(String str, boolean dontGenerateNewIds);
|
// Path: src/main/java/com/skjegstad/utils/BloomFilter.java
// public interface BloomFilter<T> {
// public void add(T element);
//
// public void add(byte[] element);
//
// public boolean contains(T element);
//
// public boolean contains(byte[] element);
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/TokenMapper.java
import com.skjegstad.utils.BloomFilter;
package de.danielbasedow.prospecter.core;
public interface TokenMapper {
public int getTermId(String str, boolean dontGenerateNewIds);
|
public void setBloomFilter(BloomFilter<String> bloomFilter);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/Matcher.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryNegativeCounter.java
// public class QueryNegativeCounter {
// private final TIntByteMap bitCounts = new TIntByteHashMap();
//
// public void add(int bit) {
// bitCounts.adjustOrPutValue(bit, (byte) 1, (byte) 1);
// }
//
// public int size() {
// return bitCounts.size();
// }
//
// public byte getCountAtBit(int bit) {
// return bitCounts.get(bit);
// }
//
// public int[] getBitPositionsToSet(QueryNegativeCounter actualMatched) {
// TIntList results = new TIntArrayList();
//
// for (int bitPosition : bitCounts.keys()) {
// if (bitCounts.get(bitPosition) > actualMatched.getCountAtBit(bitPosition)) {
// results.add(bitPosition);
// }
// }
//
// return results.toArray();
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryNegativeCounter;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import gnu.trove.list.TLongList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.procedure.TLongProcedure;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
|
package de.danielbasedow.prospecter.core;
/**
* Tracks hits across multiple index fields and applies the bit from the QueryPostings.
*/
public class Matcher {
protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryNegativeCounter.java
// public class QueryNegativeCounter {
// private final TIntByteMap bitCounts = new TIntByteHashMap();
//
// public void add(int bit) {
// bitCounts.adjustOrPutValue(bit, (byte) 1, (byte) 1);
// }
//
// public int size() {
// return bitCounts.size();
// }
//
// public byte getCountAtBit(int bit) {
// return bitCounts.get(bit);
// }
//
// public int[] getBitPositionsToSet(QueryNegativeCounter actualMatched) {
// TIntList results = new TIntArrayList();
//
// for (int bitPosition : bitCounts.keys()) {
// if (bitCounts.get(bitPosition) > actualMatched.getCountAtBit(bitPosition)) {
// results.add(bitPosition);
// }
// }
//
// return results.toArray();
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryNegativeCounter;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import gnu.trove.list.TLongList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.procedure.TLongProcedure;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
package de.danielbasedow.prospecter.core;
/**
* Tracks hits across multiple index fields and applies the bit from the QueryPostings.
*/
public class Matcher {
protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
|
protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/Matcher.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryNegativeCounter.java
// public class QueryNegativeCounter {
// private final TIntByteMap bitCounts = new TIntByteHashMap();
//
// public void add(int bit) {
// bitCounts.adjustOrPutValue(bit, (byte) 1, (byte) 1);
// }
//
// public int size() {
// return bitCounts.size();
// }
//
// public byte getCountAtBit(int bit) {
// return bitCounts.get(bit);
// }
//
// public int[] getBitPositionsToSet(QueryNegativeCounter actualMatched) {
// TIntList results = new TIntArrayList();
//
// for (int bitPosition : bitCounts.keys()) {
// if (bitCounts.get(bitPosition) > actualMatched.getCountAtBit(bitPosition)) {
// results.add(bitPosition);
// }
// }
//
// return results.toArray();
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryNegativeCounter;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import gnu.trove.list.TLongList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.procedure.TLongProcedure;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
|
package de.danielbasedow.prospecter.core;
/**
* Tracks hits across multiple index fields and applies the bit from the QueryPostings.
*/
public class Matcher {
protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryNegativeCounter.java
// public class QueryNegativeCounter {
// private final TIntByteMap bitCounts = new TIntByteHashMap();
//
// public void add(int bit) {
// bitCounts.adjustOrPutValue(bit, (byte) 1, (byte) 1);
// }
//
// public int size() {
// return bitCounts.size();
// }
//
// public byte getCountAtBit(int bit) {
// return bitCounts.get(bit);
// }
//
// public int[] getBitPositionsToSet(QueryNegativeCounter actualMatched) {
// TIntList results = new TIntArrayList();
//
// for (int bitPosition : bitCounts.keys()) {
// if (bitCounts.get(bitPosition) > actualMatched.getCountAtBit(bitPosition)) {
// results.add(bitPosition);
// }
// }
//
// return results.toArray();
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryNegativeCounter;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import gnu.trove.list.TLongList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.procedure.TLongProcedure;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
package de.danielbasedow.prospecter.core;
/**
* Tracks hits across multiple index fields and applies the bit from the QueryPostings.
*/
public class Matcher {
protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
|
protected final QueryManager queryManager;
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/Matcher.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryNegativeCounter.java
// public class QueryNegativeCounter {
// private final TIntByteMap bitCounts = new TIntByteHashMap();
//
// public void add(int bit) {
// bitCounts.adjustOrPutValue(bit, (byte) 1, (byte) 1);
// }
//
// public int size() {
// return bitCounts.size();
// }
//
// public byte getCountAtBit(int bit) {
// return bitCounts.get(bit);
// }
//
// public int[] getBitPositionsToSet(QueryNegativeCounter actualMatched) {
// TIntList results = new TIntArrayList();
//
// for (int bitPosition : bitCounts.keys()) {
// if (bitCounts.get(bitPosition) > actualMatched.getCountAtBit(bitPosition)) {
// results.add(bitPosition);
// }
// }
//
// return results.toArray();
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryNegativeCounter;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import gnu.trove.list.TLongList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.procedure.TLongProcedure;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
|
package de.danielbasedow.prospecter.core;
/**
* Tracks hits across multiple index fields and applies the bit from the QueryPostings.
*/
public class Matcher {
protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
protected final QueryManager queryManager;
public Matcher(QueryManager qm) {
queryManager = qm;
}
public void addHits(TLongList postings) {
postings.forEach(new TLongProcedure() {
@Override
public boolean execute(long posting) {
addHit(posting);
return true;
}
});
}
public void addHit(long posting) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryManager.java
// public class QueryManager {
// protected final TIntIntHashMap bitCounts = new TIntIntHashMap();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeCounts = new TIntObjectHashMap<QueryNegativeCounter>();
//
// public void addQuery(Query query) {
// bitCounts.put(query.getQueryId(), query.getBits());
// if (query.hasNegatives()) {
// negativeCounts.put(query.getQueryId(), query.getNegativeMask());
// }
//
// }
//
// public BitSet getMask(int queryId) {
// BitSet set = new BitSet();
// set.set(0, bitCounts.get(queryId), true);
// return set;
// }
//
// public void deleteQuery(int queryId) {
// bitCounts.remove(queryId);
// }
//
// public QueryNegativeCounter getQueryNegativeCounter(int queryId) {
// return negativeCounts.get(queryId);
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryNegativeCounter.java
// public class QueryNegativeCounter {
// private final TIntByteMap bitCounts = new TIntByteHashMap();
//
// public void add(int bit) {
// bitCounts.adjustOrPutValue(bit, (byte) 1, (byte) 1);
// }
//
// public int size() {
// return bitCounts.size();
// }
//
// public byte getCountAtBit(int bit) {
// return bitCounts.get(bit);
// }
//
// public int[] getBitPositionsToSet(QueryNegativeCounter actualMatched) {
// TIntList results = new TIntArrayList();
//
// for (int bitPosition : bitCounts.keys()) {
// if (bitCounts.get(bitPosition) > actualMatched.getCountAtBit(bitPosition)) {
// results.add(bitPosition);
// }
// }
//
// return results.toArray();
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
import de.danielbasedow.prospecter.core.query.QueryManager;
import de.danielbasedow.prospecter.core.query.QueryNegativeCounter;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import gnu.trove.list.TLongList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.procedure.TIntObjectProcedure;
import gnu.trove.procedure.TLongProcedure;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
package de.danielbasedow.prospecter.core;
/**
* Tracks hits across multiple index fields and applies the bit from the QueryPostings.
*/
public class Matcher {
protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
protected final QueryManager queryManager;
public Matcher(QueryManager qm) {
queryManager = qm;
}
public void addHits(TLongList postings) {
postings.forEach(new TLongProcedure() {
@Override
public boolean execute(long posting) {
addHit(posting);
return true;
}
});
}
public void addHit(long posting) {
|
int[] unpacked = QueryPosting.unpack(posting);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/document/Field.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import de.danielbasedow.prospecter.core.Token;
import java.util.List;
|
package de.danielbasedow.prospecter.core.document;
/**
* Represents a field of a document.
*/
public class Field {
protected final String name;
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
import de.danielbasedow.prospecter.core.Token;
import java.util.List;
package de.danielbasedow.prospecter.core.document;
/**
* Represents a field of a document.
*/
public class Field {
protected final String name;
|
protected final List<Token> tokens;
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/Query.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import aima.core.logic.propositional.visitors.ConvertToCNF;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.*;
import java.util.*;
|
package de.danielbasedow.prospecter.core.query;
/**
* represents a Query (a tuple of queryId, bitmask and a list of conditions)
*/
public class Query {
protected final int queryId;
protected final int bits;
protected final QueryNegativeCounter negativeMask = new QueryNegativeCounter();
protected final ClauseNode clauseNode;
protected final Map<Condition, Long> postings = new HashMap<Condition, Long>();
public int getQueryId() {
return queryId;
}
public Query(int queryId, ClauseNode clauseNode) {
this.clauseNode = clauseNode;
this.queryId = queryId;
Sentence cnf = getCNF(clauseNode);
int tmpBits = 0;
for (int bit = 0; bit < cnf.getNumberSimplerSentences(); bit++) {
tmpBits++;
Sentence disjunction = cnf.getSimplerSentence(bit);
for (int p = 0; p < disjunction.getNumberSimplerSentences(); p++) {
Sentence sentence = disjunction.getSimplerSentence(p);
boolean isNegativeCondition = false;
if (sentence.isNotSentence()) {
sentence = sentence.getSimplerSentence(0);
isNegativeCondition = true;
}
Condition condition = ((PropositionSymbol) sentence).getCondition();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Query.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import aima.core.logic.propositional.visitors.ConvertToCNF;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.*;
import java.util.*;
package de.danielbasedow.prospecter.core.query;
/**
* represents a Query (a tuple of queryId, bitmask and a list of conditions)
*/
public class Query {
protected final int queryId;
protected final int bits;
protected final QueryNegativeCounter negativeMask = new QueryNegativeCounter();
protected final ClauseNode clauseNode;
protected final Map<Condition, Long> postings = new HashMap<Condition, Long>();
public int getQueryId() {
return queryId;
}
public Query(int queryId, ClauseNode clauseNode) {
this.clauseNode = clauseNode;
this.queryId = queryId;
Sentence cnf = getCNF(clauseNode);
int tmpBits = 0;
for (int bit = 0; bit < cnf.getNumberSimplerSentences(); bit++) {
tmpBits++;
Sentence disjunction = cnf.getSimplerSentence(bit);
for (int p = 0; p < disjunction.getNumberSimplerSentences(); p++) {
Sentence sentence = disjunction.getSimplerSentence(p);
boolean isNegativeCondition = false;
if (sentence.isNotSentence()) {
sentence = sentence.getSimplerSentence(0);
isNegativeCondition = true;
}
Condition condition = ((PropositionSymbol) sentence).getCondition();
|
if (condition.getToken().getCondition() == MatchCondition.IN) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/Query.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import aima.core.logic.propositional.visitors.ConvertToCNF;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.*;
import java.util.*;
|
package de.danielbasedow.prospecter.core.query;
/**
* represents a Query (a tuple of queryId, bitmask and a list of conditions)
*/
public class Query {
protected final int queryId;
protected final int bits;
protected final QueryNegativeCounter negativeMask = new QueryNegativeCounter();
protected final ClauseNode clauseNode;
protected final Map<Condition, Long> postings = new HashMap<Condition, Long>();
public int getQueryId() {
return queryId;
}
public Query(int queryId, ClauseNode clauseNode) {
this.clauseNode = clauseNode;
this.queryId = queryId;
Sentence cnf = getCNF(clauseNode);
int tmpBits = 0;
for (int bit = 0; bit < cnf.getNumberSimplerSentences(); bit++) {
tmpBits++;
Sentence disjunction = cnf.getSimplerSentence(bit);
for (int p = 0; p < disjunction.getNumberSimplerSentences(); p++) {
Sentence sentence = disjunction.getSimplerSentence(p);
boolean isNegativeCondition = false;
if (sentence.isNotSentence()) {
sentence = sentence.getSimplerSentence(0);
isNegativeCondition = true;
}
Condition condition = ((PropositionSymbol) sentence).getCondition();
if (condition.getToken().getCondition() == MatchCondition.IN) {
//If this is an IN query we're dealing with a Token containing a List<Token>
Object t = condition.getToken().getToken();
if (t instanceof List) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Query.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import aima.core.logic.propositional.visitors.ConvertToCNF;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.*;
import java.util.*;
package de.danielbasedow.prospecter.core.query;
/**
* represents a Query (a tuple of queryId, bitmask and a list of conditions)
*/
public class Query {
protected final int queryId;
protected final int bits;
protected final QueryNegativeCounter negativeMask = new QueryNegativeCounter();
protected final ClauseNode clauseNode;
protected final Map<Condition, Long> postings = new HashMap<Condition, Long>();
public int getQueryId() {
return queryId;
}
public Query(int queryId, ClauseNode clauseNode) {
this.clauseNode = clauseNode;
this.queryId = queryId;
Sentence cnf = getCNF(clauseNode);
int tmpBits = 0;
for (int bit = 0; bit < cnf.getNumberSimplerSentences(); bit++) {
tmpBits++;
Sentence disjunction = cnf.getSimplerSentence(bit);
for (int p = 0; p < disjunction.getNumberSimplerSentences(); p++) {
Sentence sentence = disjunction.getSimplerSentence(p);
boolean isNegativeCondition = false;
if (sentence.isNotSentence()) {
sentence = sentence.getSimplerSentence(0);
isNegativeCondition = true;
}
Condition condition = ((PropositionSymbol) sentence).getCondition();
if (condition.getToken().getCondition() == MatchCondition.IN) {
//If this is an IN query we're dealing with a Token containing a List<Token>
Object t = condition.getToken().getToken();
if (t instanceof List) {
|
for (Token token : (List<Token>) t) {
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/QueryPostingTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
|
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core;
public class QueryPostingTest extends TestCase {
public void testPacking() {
long l;
int[] ab;
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/QueryPostingTest.java
import de.danielbasedow.prospecter.core.query.QueryPosting;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core;
public class QueryPostingTest extends TestCase {
public void testPacking() {
long l;
int[] ab;
|
l = QueryPosting.pack(0, 0, false);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/ConditionTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core.query;
public class ConditionTest extends TestCase {
public void testSymbolName() {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/ConditionTest.java
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.query;
public class ConditionTest extends TestCase {
public void testSymbolName() {
|
Token<String> t = new Token<String>("bar");
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/ConditionTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core.query;
public class ConditionTest extends TestCase {
public void testSymbolName() {
Token<String> t = new Token<String>("bar");
Condition condition = new Condition("foo", t);
assertEquals("fooNONEbar", condition.getSymbolName());
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/ConditionTest.java
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.query;
public class ConditionTest extends TestCase {
public void testSymbolName() {
Token<String> t = new Token<String>("bar");
Condition condition = new Condition("foo", t);
assertEquals("fooNONEbar", condition.getSymbolName());
|
t = new Token<String>("bar", MatchCondition.EQUALS);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSONTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/IntegerIndex.java
// public class IntegerIndex extends AbstractRangeFieldIndex<Integer> {
//
// public IntegerIndex(String name) {
// super(name);
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.INTEGER;
// }
//
//
// }
|
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.index.IntegerIndex;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core.schema;
public class SchemaBuilderJSONTest extends TestCase {
public void testValidJSON() {
String json = "{" +
" \"fields\": {" +
" \"textField\": {" +
" \"type\": \"FullText\"," +
" \"options\": {" +
" \"analyzer\": \"de.danielbasedow.prospecter.core.analysis.LuceneStandardAnalyzer\"" +
" }" +
" }," +
" \"price\": {" +
" \"type\": \"Integer\"" +
" }" +
" }" +
"}";
Schema schema;
try {
SchemaBuilder builder = new SchemaBuilderJSON(json);
schema = builder.getSchema();
assertEquals(2, schema.getFieldCount());
|
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/IntegerIndex.java
// public class IntegerIndex extends AbstractRangeFieldIndex<Integer> {
//
// public IntegerIndex(String name) {
// super(name);
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.INTEGER;
// }
//
//
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSONTest.java
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.index.IntegerIndex;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.schema;
public class SchemaBuilderJSONTest extends TestCase {
public void testValidJSON() {
String json = "{" +
" \"fields\": {" +
" \"textField\": {" +
" \"type\": \"FullText\"," +
" \"options\": {" +
" \"analyzer\": \"de.danielbasedow.prospecter.core.analysis.LuceneStandardAnalyzer\"" +
" }" +
" }," +
" \"price\": {" +
" \"type\": \"Integer\"" +
" }" +
" }" +
"}";
Schema schema;
try {
SchemaBuilder builder = new SchemaBuilderJSON(json);
schema = builder.getSchema();
assertEquals(2, schema.getFieldCount());
|
assertTrue(schema.getFieldIndex("price") instanceof IntegerIndex);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSONTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/IntegerIndex.java
// public class IntegerIndex extends AbstractRangeFieldIndex<Integer> {
//
// public IntegerIndex(String name) {
// super(name);
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.INTEGER;
// }
//
//
// }
|
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.index.IntegerIndex;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core.schema;
public class SchemaBuilderJSONTest extends TestCase {
public void testValidJSON() {
String json = "{" +
" \"fields\": {" +
" \"textField\": {" +
" \"type\": \"FullText\"," +
" \"options\": {" +
" \"analyzer\": \"de.danielbasedow.prospecter.core.analysis.LuceneStandardAnalyzer\"" +
" }" +
" }," +
" \"price\": {" +
" \"type\": \"Integer\"" +
" }" +
" }" +
"}";
Schema schema;
try {
SchemaBuilder builder = new SchemaBuilderJSON(json);
schema = builder.getSchema();
assertEquals(2, schema.getFieldCount());
assertTrue(schema.getFieldIndex("price") instanceof IntegerIndex);
|
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
// private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
//
// protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
//
// private final Analyzer analyzer;
//
// public FullTextIndex(String name, Analyzer analyzer) {
// super(name);
// this.analyzer = analyzer;
// }
//
// @Override
// public void addPosting(Token token, Long posting) {
// TLongList postingList;
// if (index.containsKey((Integer) token.getToken())) {
// postingList = index.get((Integer) token.getToken());
// } else {
// postingList = new TLongArrayList();
// index.put((Integer) token.getToken(), postingList);
// }
// postingList.add(posting);
// }
//
// @Override
// public void removePosting(Token token, Long posting) {
// TLongList postingList = index.get((Integer) token.getToken());
// if (postingList != null && postingList.contains(posting)) {
// LOGGER.debug("removing posting: " + String.valueOf(posting));
// postingList.remove(posting);
// }
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.FULL_TEXT;
// }
//
// public TLongList getQueryPostingsForTermId(Token token) {
// Integer t = (Integer) token.getToken();
// if (index.containsKey(t)) {
// return index.get(t);
// }
// return null;
// }
//
// @Override
// public void match(Field field, Matcher matcher) {
// for (Token token : field.getTokens()) {
// Integer t = (Integer) token.getToken();
// TLongList additionalPostings = index.get(t);
// if (additionalPostings != null) {
// matcher.addHits(additionalPostings);
// }
// }
// }
//
// public Analyzer getAnalyzer() {
// return analyzer;
// }
//
// public void trim() {
// for (Object list : index.values()) {
// if (list instanceof ArrayList) {
// ((ArrayList) list).trimToSize();
// }
// }
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/index/IntegerIndex.java
// public class IntegerIndex extends AbstractRangeFieldIndex<Integer> {
//
// public IntegerIndex(String name) {
// super(name);
// }
//
// @Override
// public FieldType getFieldType() {
// return FieldType.INTEGER;
// }
//
//
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSONTest.java
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.index.IntegerIndex;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.schema;
public class SchemaBuilderJSONTest extends TestCase {
public void testValidJSON() {
String json = "{" +
" \"fields\": {" +
" \"textField\": {" +
" \"type\": \"FullText\"," +
" \"options\": {" +
" \"analyzer\": \"de.danielbasedow.prospecter.core.analysis.LuceneStandardAnalyzer\"" +
" }" +
" }," +
" \"price\": {" +
" \"type\": \"Integer\"" +
" }" +
" }" +
"}";
Schema schema;
try {
SchemaBuilder builder = new SchemaBuilderJSON(json);
schema = builder.getSchema();
assertEquals(2, schema.getFieldCount());
assertTrue(schema.getFieldIndex("price") instanceof IntegerIndex);
|
assertTrue(schema.getFieldIndex("textField") instanceof FullTextIndex);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionSymbol.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
|
import aima.core.logic.propositional.parsing.ast.AtomicSentence;
import de.danielbasedow.prospecter.core.query.Condition;
|
package de.danielbasedow.prospecter.core.query.build;
public class PropositionSymbol extends AtomicSentence implements aima.core.logic.propositional.parsing.ast.PropositionSymbol {
public static final String TRUE_SYMBOL = "True";
public static final String FALSE_SYMBOL = "False";
public static final AbstractPropositionalSymbol TRUE = new AbstractPropositionalSymbol(TRUE_SYMBOL);
public static final AbstractPropositionalSymbol FALSE = new AbstractPropositionalSymbol(FALSE_SYMBOL);
|
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionSymbol.java
import aima.core.logic.propositional.parsing.ast.AtomicSentence;
import de.danielbasedow.prospecter.core.query.Condition;
package de.danielbasedow.prospecter.core.query.build;
public class PropositionSymbol extends AtomicSentence implements aima.core.logic.propositional.parsing.ast.PropositionSymbol {
public static final String TRUE_SYMBOL = "True";
public static final String FALSE_SYMBOL = "False";
public static final AbstractPropositionalSymbol TRUE = new AbstractPropositionalSymbol(TRUE_SYMBOL);
public static final AbstractPropositionalSymbol FALSE = new AbstractPropositionalSymbol(FALSE_SYMBOL);
|
private final Condition condition;
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/FieldIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
|
package de.danielbasedow.prospecter.core.index;
/**
* Interface representing an index for a field encountered in queries and documents. The data types and methods for
* matching vary from index type to index type.
*/
public interface FieldIndex {
public String getName();
/**
* Finds all QueryPosting that match the given Field and returns them as a List
*
* @param field Field instance from Document to match against
*/
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FieldIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
package de.danielbasedow.prospecter.core.index;
/**
* Interface representing an index for a field encountered in queries and documents. The data types and methods for
* matching vary from index type to index type.
*/
public interface FieldIndex {
public String getName();
/**
* Finds all QueryPosting that match the given Field and returns them as a List
*
* @param field Field instance from Document to match against
*/
|
public void match(Field field, Matcher matcher);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/FieldIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
|
package de.danielbasedow.prospecter.core.index;
/**
* Interface representing an index for a field encountered in queries and documents. The data types and methods for
* matching vary from index type to index type.
*/
public interface FieldIndex {
public String getName();
/**
* Finds all QueryPosting that match the given Field and returns them as a List
*
* @param field Field instance from Document to match against
*/
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FieldIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
package de.danielbasedow.prospecter.core.index;
/**
* Interface representing an index for a field encountered in queries and documents. The data types and methods for
* matching vary from index type to index type.
*/
public interface FieldIndex {
public String getName();
/**
* Finds all QueryPosting that match the given Field and returns them as a List
*
* @param field Field instance from Document to match against
*/
|
public void match(Field field, Matcher matcher);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/FieldIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
|
package de.danielbasedow.prospecter.core.index;
/**
* Interface representing an index for a field encountered in queries and documents. The data types and methods for
* matching vary from index type to index type.
*/
public interface FieldIndex {
public String getName();
/**
* Finds all QueryPosting that match the given Field and returns them as a List
*
* @param field Field instance from Document to match against
*/
public void match(Field field, Matcher matcher);
/**
* Add a single QueryPosting that will be matched if token is present in the field in match()
*
* @param token Token to match on later on
* @param posting query posting
*/
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FieldIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
package de.danielbasedow.prospecter.core.index;
/**
* Interface representing an index for a field encountered in queries and documents. The data types and methods for
* matching vary from index type to index type.
*/
public interface FieldIndex {
public String getName();
/**
* Finds all QueryPosting that match the given Field and returns them as a List
*
* @param field Field instance from Document to match against
*/
public void match(Field field, Matcher matcher);
/**
* Add a single QueryPosting that will be matched if token is present in the field in match()
*
* @param token Token to match on later on
* @param posting query posting
*/
|
public void addPosting(Token token, Long posting);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/build/AbstractFieldHandler.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/InvalidQueryException.java
// public class InvalidQueryException extends RuntimeException {
// public InvalidQueryException(String msg) {
// super(msg);
// }
//
// public InvalidQueryException(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.InvalidQueryException;
|
package de.danielbasedow.prospecter.core.query.build;
public class AbstractFieldHandler implements FieldHandler {
protected final ObjectNode root;
protected final String fieldName;
public AbstractFieldHandler(ObjectNode node, String fieldName) {
root = node;
this.fieldName = fieldName;
}
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/InvalidQueryException.java
// public class InvalidQueryException extends RuntimeException {
// public InvalidQueryException(String msg) {
// super(msg);
// }
//
// public InvalidQueryException(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/AbstractFieldHandler.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.InvalidQueryException;
package de.danielbasedow.prospecter.core.query.build;
public class AbstractFieldHandler implements FieldHandler {
protected final ObjectNode root;
protected final String fieldName;
public AbstractFieldHandler(ObjectNode node, String fieldName) {
root = node;
this.fieldName = fieldName;
}
|
protected MatchCondition getMatchCondition(String comparator) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/build/AbstractFieldHandler.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/InvalidQueryException.java
// public class InvalidQueryException extends RuntimeException {
// public InvalidQueryException(String msg) {
// super(msg);
// }
//
// public InvalidQueryException(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.InvalidQueryException;
|
package de.danielbasedow.prospecter.core.query.build;
public class AbstractFieldHandler implements FieldHandler {
protected final ObjectNode root;
protected final String fieldName;
public AbstractFieldHandler(ObjectNode node, String fieldName) {
root = node;
this.fieldName = fieldName;
}
protected MatchCondition getMatchCondition(String comparator) {
if ("gt".equals(comparator)) {
return MatchCondition.GREATER_THAN;
} else if ("gte".equals(comparator)) {
return MatchCondition.GREATER_THAN_EQUALS;
} else if ("lt".equals(comparator)) {
return MatchCondition.LESS_THAN;
} else if ("lte".equals(comparator)) {
return MatchCondition.LESS_THAN_EQUALS;
} else if ("eq".equals(comparator)) {
return MatchCondition.EQUALS;
} else {
return MatchCondition.NONE;
}
}
protected JsonNode getValue() {
JsonNode valNode = root.get("value");
if (valNode == null) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/InvalidQueryException.java
// public class InvalidQueryException extends RuntimeException {
// public InvalidQueryException(String msg) {
// super(msg);
// }
//
// public InvalidQueryException(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/AbstractFieldHandler.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.InvalidQueryException;
package de.danielbasedow.prospecter.core.query.build;
public class AbstractFieldHandler implements FieldHandler {
protected final ObjectNode root;
protected final String fieldName;
public AbstractFieldHandler(ObjectNode node, String fieldName) {
root = node;
this.fieldName = fieldName;
}
protected MatchCondition getMatchCondition(String comparator) {
if ("gt".equals(comparator)) {
return MatchCondition.GREATER_THAN;
} else if ("gte".equals(comparator)) {
return MatchCondition.GREATER_THAN_EQUALS;
} else if ("lt".equals(comparator)) {
return MatchCondition.LESS_THAN;
} else if ("lte".equals(comparator)) {
return MatchCondition.LESS_THAN_EQUALS;
} else if ("eq".equals(comparator)) {
return MatchCondition.EQUALS;
} else {
return MatchCondition.NONE;
}
}
protected JsonNode getValue() {
JsonNode valNode = root.get("value");
if (valNode == null) {
|
throw new InvalidQueryException("No value node found");
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSON.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/analysis/Analyzer.java
// public interface Analyzer {
// /**
// * Tokenizes raw input
// *
// * @param input raw String that should be turned into tokens
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input) throws TokenizerException;
//
// /**
// * Tokenizes raw input. It is possible to turn off generating formerly unknown tokens. This makes sense when
// * tokenizing documents, as any token in a document has to have been already seen in a query to have any chance
// * of matching.
// *
// * @param input raw String that should be turned into tokens
// * @param dontGenerateNewIds if set to true no new tokens will be generated.
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input, boolean dontGenerateNewIds) throws TokenizerException;
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/DummyQueryStorage.java
// public class DummyQueryStorage implements QueryStorage {
// @Override
// public void addQuery(Integer queryId, String json) {
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return new HashSet<Map.Entry<Integer, String>>();
// }
//
// @Override
// public void deleteQuery(Integer queryId) {
// }
//
// @Override
// public void close() {
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return null;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/MapDBStore.java
// public class MapDBStore implements QueryStorage {
// private static final Logger LOGGER = LoggerFactory.getLogger(MapDBStore.class);
//
// private static final int DEFAULT_UNWRITTEN_CHANGES_LIMIT = 10000;
// private final DB database;
// private final HTreeMap<Integer, String> map;
// private int unwrittenChangesCount;
// private final int unwrittenChangesLimit;
// private final String name;
//
// public MapDBStore(File file) {
// name = file.getName();
// LOGGER.debug("opening query store " + name);
// database = DBMaker.newFileDB(file).make();
// LOGGER.debug("reading query store " + name);
// map = database.getHashMap("queries");
// unwrittenChangesCount = 0;
// unwrittenChangesLimit = DEFAULT_UNWRITTEN_CHANGES_LIMIT;
// }
//
// @Override
// public void addQuery(Integer queryId, String json) {
// map.put(queryId, json);
// commitIfNecessary();
// }
//
// private void commitIfNecessary() {
// unwrittenChangesCount++;
// if (unwrittenChangesCount >= unwrittenChangesLimit) {
// LOGGER.debug("committing changes in query store (auto-commit limit reached)");
// unwrittenChangesCount = 0;
// database.commit();
// }
// }
//
// public void deleteQuery(Integer queryId) {
// map.remove(queryId);
// commitIfNecessary();
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return map.entrySet();
// }
//
// @Override
// public void close() {
// LOGGER.debug("closing query store: " + name);
// database.commit();
// database.close();
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return map.get(queryId);
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import de.danielbasedow.prospecter.core.analysis.Analyzer;
import de.danielbasedow.prospecter.core.index.*;
import de.danielbasedow.prospecter.core.persistence.DummyQueryStorage;
import de.danielbasedow.prospecter.core.persistence.MapDBStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Map;
|
/**
* Build Schema from a JSON file
*
* @param file file to read JSON from
* @throws SchemaConfigurationError
*/
public SchemaBuilderJSON(File file) throws SchemaConfigurationError {
schemaDirectory = file.getParent();
ObjectMapper objectMapper = new ObjectMapper();
try {
LOGGER.debug("parsing schema " + file.getAbsoluteFile());
root = (ObjectNode) objectMapper.readTree(file);
} catch (IOException e) {
LOGGER.error(e.getLocalizedMessage());
throw new SchemaConfigurationError("Could not parse schema JSON from file " + file.getAbsoluteFile());
}
schema = new SchemaImpl();
}
private void parseJSON() throws SchemaConfigurationError {
try {
ObjectNode fields = (ObjectNode) root.get("fields");
Iterator<Map.Entry<String, JsonNode>> iterator = fields.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
FieldIndex index = buildField(entry.getKey(), entry.getValue());
schema.addFieldIndex(index.getName(), index);
}
JsonNode persistence = root.get("persistence");
//as a default set DummyQueryStorage. Only if persistence options are provided overwrite it
|
// Path: src/main/java/de/danielbasedow/prospecter/core/analysis/Analyzer.java
// public interface Analyzer {
// /**
// * Tokenizes raw input
// *
// * @param input raw String that should be turned into tokens
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input) throws TokenizerException;
//
// /**
// * Tokenizes raw input. It is possible to turn off generating formerly unknown tokens. This makes sense when
// * tokenizing documents, as any token in a document has to have been already seen in a query to have any chance
// * of matching.
// *
// * @param input raw String that should be turned into tokens
// * @param dontGenerateNewIds if set to true no new tokens will be generated.
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input, boolean dontGenerateNewIds) throws TokenizerException;
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/DummyQueryStorage.java
// public class DummyQueryStorage implements QueryStorage {
// @Override
// public void addQuery(Integer queryId, String json) {
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return new HashSet<Map.Entry<Integer, String>>();
// }
//
// @Override
// public void deleteQuery(Integer queryId) {
// }
//
// @Override
// public void close() {
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return null;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/MapDBStore.java
// public class MapDBStore implements QueryStorage {
// private static final Logger LOGGER = LoggerFactory.getLogger(MapDBStore.class);
//
// private static final int DEFAULT_UNWRITTEN_CHANGES_LIMIT = 10000;
// private final DB database;
// private final HTreeMap<Integer, String> map;
// private int unwrittenChangesCount;
// private final int unwrittenChangesLimit;
// private final String name;
//
// public MapDBStore(File file) {
// name = file.getName();
// LOGGER.debug("opening query store " + name);
// database = DBMaker.newFileDB(file).make();
// LOGGER.debug("reading query store " + name);
// map = database.getHashMap("queries");
// unwrittenChangesCount = 0;
// unwrittenChangesLimit = DEFAULT_UNWRITTEN_CHANGES_LIMIT;
// }
//
// @Override
// public void addQuery(Integer queryId, String json) {
// map.put(queryId, json);
// commitIfNecessary();
// }
//
// private void commitIfNecessary() {
// unwrittenChangesCount++;
// if (unwrittenChangesCount >= unwrittenChangesLimit) {
// LOGGER.debug("committing changes in query store (auto-commit limit reached)");
// unwrittenChangesCount = 0;
// database.commit();
// }
// }
//
// public void deleteQuery(Integer queryId) {
// map.remove(queryId);
// commitIfNecessary();
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return map.entrySet();
// }
//
// @Override
// public void close() {
// LOGGER.debug("closing query store: " + name);
// database.commit();
// database.close();
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return map.get(queryId);
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSON.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import de.danielbasedow.prospecter.core.analysis.Analyzer;
import de.danielbasedow.prospecter.core.index.*;
import de.danielbasedow.prospecter.core.persistence.DummyQueryStorage;
import de.danielbasedow.prospecter.core.persistence.MapDBStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Map;
/**
* Build Schema from a JSON file
*
* @param file file to read JSON from
* @throws SchemaConfigurationError
*/
public SchemaBuilderJSON(File file) throws SchemaConfigurationError {
schemaDirectory = file.getParent();
ObjectMapper objectMapper = new ObjectMapper();
try {
LOGGER.debug("parsing schema " + file.getAbsoluteFile());
root = (ObjectNode) objectMapper.readTree(file);
} catch (IOException e) {
LOGGER.error(e.getLocalizedMessage());
throw new SchemaConfigurationError("Could not parse schema JSON from file " + file.getAbsoluteFile());
}
schema = new SchemaImpl();
}
private void parseJSON() throws SchemaConfigurationError {
try {
ObjectNode fields = (ObjectNode) root.get("fields");
Iterator<Map.Entry<String, JsonNode>> iterator = fields.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
FieldIndex index = buildField(entry.getKey(), entry.getValue());
schema.addFieldIndex(index.getName(), index);
}
JsonNode persistence = root.get("persistence");
//as a default set DummyQueryStorage. Only if persistence options are provided overwrite it
|
schema.setQueryStorage(new DummyQueryStorage());
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSON.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/analysis/Analyzer.java
// public interface Analyzer {
// /**
// * Tokenizes raw input
// *
// * @param input raw String that should be turned into tokens
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input) throws TokenizerException;
//
// /**
// * Tokenizes raw input. It is possible to turn off generating formerly unknown tokens. This makes sense when
// * tokenizing documents, as any token in a document has to have been already seen in a query to have any chance
// * of matching.
// *
// * @param input raw String that should be turned into tokens
// * @param dontGenerateNewIds if set to true no new tokens will be generated.
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input, boolean dontGenerateNewIds) throws TokenizerException;
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/DummyQueryStorage.java
// public class DummyQueryStorage implements QueryStorage {
// @Override
// public void addQuery(Integer queryId, String json) {
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return new HashSet<Map.Entry<Integer, String>>();
// }
//
// @Override
// public void deleteQuery(Integer queryId) {
// }
//
// @Override
// public void close() {
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return null;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/MapDBStore.java
// public class MapDBStore implements QueryStorage {
// private static final Logger LOGGER = LoggerFactory.getLogger(MapDBStore.class);
//
// private static final int DEFAULT_UNWRITTEN_CHANGES_LIMIT = 10000;
// private final DB database;
// private final HTreeMap<Integer, String> map;
// private int unwrittenChangesCount;
// private final int unwrittenChangesLimit;
// private final String name;
//
// public MapDBStore(File file) {
// name = file.getName();
// LOGGER.debug("opening query store " + name);
// database = DBMaker.newFileDB(file).make();
// LOGGER.debug("reading query store " + name);
// map = database.getHashMap("queries");
// unwrittenChangesCount = 0;
// unwrittenChangesLimit = DEFAULT_UNWRITTEN_CHANGES_LIMIT;
// }
//
// @Override
// public void addQuery(Integer queryId, String json) {
// map.put(queryId, json);
// commitIfNecessary();
// }
//
// private void commitIfNecessary() {
// unwrittenChangesCount++;
// if (unwrittenChangesCount >= unwrittenChangesLimit) {
// LOGGER.debug("committing changes in query store (auto-commit limit reached)");
// unwrittenChangesCount = 0;
// database.commit();
// }
// }
//
// public void deleteQuery(Integer queryId) {
// map.remove(queryId);
// commitIfNecessary();
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return map.entrySet();
// }
//
// @Override
// public void close() {
// LOGGER.debug("closing query store: " + name);
// database.commit();
// database.close();
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return map.get(queryId);
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import de.danielbasedow.prospecter.core.analysis.Analyzer;
import de.danielbasedow.prospecter.core.index.*;
import de.danielbasedow.prospecter.core.persistence.DummyQueryStorage;
import de.danielbasedow.prospecter.core.persistence.MapDBStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Map;
|
*/
public SchemaBuilderJSON(File file) throws SchemaConfigurationError {
schemaDirectory = file.getParent();
ObjectMapper objectMapper = new ObjectMapper();
try {
LOGGER.debug("parsing schema " + file.getAbsoluteFile());
root = (ObjectNode) objectMapper.readTree(file);
} catch (IOException e) {
LOGGER.error(e.getLocalizedMessage());
throw new SchemaConfigurationError("Could not parse schema JSON from file " + file.getAbsoluteFile());
}
schema = new SchemaImpl();
}
private void parseJSON() throws SchemaConfigurationError {
try {
ObjectNode fields = (ObjectNode) root.get("fields");
Iterator<Map.Entry<String, JsonNode>> iterator = fields.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
FieldIndex index = buildField(entry.getKey(), entry.getValue());
schema.addFieldIndex(index.getName(), index);
}
JsonNode persistence = root.get("persistence");
//as a default set DummyQueryStorage. Only if persistence options are provided overwrite it
schema.setQueryStorage(new DummyQueryStorage());
if (persistence != null && persistence.getNodeType() == JsonNodeType.OBJECT) {
//if persistence key doesn't exist there is no persistence
JsonNode file = persistence.get("file");
if (file != null && file.getNodeType() == JsonNodeType.STRING) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/analysis/Analyzer.java
// public interface Analyzer {
// /**
// * Tokenizes raw input
// *
// * @param input raw String that should be turned into tokens
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input) throws TokenizerException;
//
// /**
// * Tokenizes raw input. It is possible to turn off generating formerly unknown tokens. This makes sense when
// * tokenizing documents, as any token in a document has to have been already seen in a query to have any chance
// * of matching.
// *
// * @param input raw String that should be turned into tokens
// * @param dontGenerateNewIds if set to true no new tokens will be generated.
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input, boolean dontGenerateNewIds) throws TokenizerException;
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/DummyQueryStorage.java
// public class DummyQueryStorage implements QueryStorage {
// @Override
// public void addQuery(Integer queryId, String json) {
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return new HashSet<Map.Entry<Integer, String>>();
// }
//
// @Override
// public void deleteQuery(Integer queryId) {
// }
//
// @Override
// public void close() {
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return null;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/MapDBStore.java
// public class MapDBStore implements QueryStorage {
// private static final Logger LOGGER = LoggerFactory.getLogger(MapDBStore.class);
//
// private static final int DEFAULT_UNWRITTEN_CHANGES_LIMIT = 10000;
// private final DB database;
// private final HTreeMap<Integer, String> map;
// private int unwrittenChangesCount;
// private final int unwrittenChangesLimit;
// private final String name;
//
// public MapDBStore(File file) {
// name = file.getName();
// LOGGER.debug("opening query store " + name);
// database = DBMaker.newFileDB(file).make();
// LOGGER.debug("reading query store " + name);
// map = database.getHashMap("queries");
// unwrittenChangesCount = 0;
// unwrittenChangesLimit = DEFAULT_UNWRITTEN_CHANGES_LIMIT;
// }
//
// @Override
// public void addQuery(Integer queryId, String json) {
// map.put(queryId, json);
// commitIfNecessary();
// }
//
// private void commitIfNecessary() {
// unwrittenChangesCount++;
// if (unwrittenChangesCount >= unwrittenChangesLimit) {
// LOGGER.debug("committing changes in query store (auto-commit limit reached)");
// unwrittenChangesCount = 0;
// database.commit();
// }
// }
//
// public void deleteQuery(Integer queryId) {
// map.remove(queryId);
// commitIfNecessary();
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return map.entrySet();
// }
//
// @Override
// public void close() {
// LOGGER.debug("closing query store: " + name);
// database.commit();
// database.close();
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return map.get(queryId);
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSON.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import de.danielbasedow.prospecter.core.analysis.Analyzer;
import de.danielbasedow.prospecter.core.index.*;
import de.danielbasedow.prospecter.core.persistence.DummyQueryStorage;
import de.danielbasedow.prospecter.core.persistence.MapDBStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Map;
*/
public SchemaBuilderJSON(File file) throws SchemaConfigurationError {
schemaDirectory = file.getParent();
ObjectMapper objectMapper = new ObjectMapper();
try {
LOGGER.debug("parsing schema " + file.getAbsoluteFile());
root = (ObjectNode) objectMapper.readTree(file);
} catch (IOException e) {
LOGGER.error(e.getLocalizedMessage());
throw new SchemaConfigurationError("Could not parse schema JSON from file " + file.getAbsoluteFile());
}
schema = new SchemaImpl();
}
private void parseJSON() throws SchemaConfigurationError {
try {
ObjectNode fields = (ObjectNode) root.get("fields");
Iterator<Map.Entry<String, JsonNode>> iterator = fields.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
FieldIndex index = buildField(entry.getKey(), entry.getValue());
schema.addFieldIndex(index.getName(), index);
}
JsonNode persistence = root.get("persistence");
//as a default set DummyQueryStorage. Only if persistence options are provided overwrite it
schema.setQueryStorage(new DummyQueryStorage());
if (persistence != null && persistence.getNodeType() == JsonNodeType.OBJECT) {
//if persistence key doesn't exist there is no persistence
JsonNode file = persistence.get("file");
if (file != null && file.getNodeType() == JsonNodeType.STRING) {
|
schema.setQueryStorage(new MapDBStore(new File(schemaDirectory, file.asText())));
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSON.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/analysis/Analyzer.java
// public interface Analyzer {
// /**
// * Tokenizes raw input
// *
// * @param input raw String that should be turned into tokens
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input) throws TokenizerException;
//
// /**
// * Tokenizes raw input. It is possible to turn off generating formerly unknown tokens. This makes sense when
// * tokenizing documents, as any token in a document has to have been already seen in a query to have any chance
// * of matching.
// *
// * @param input raw String that should be turned into tokens
// * @param dontGenerateNewIds if set to true no new tokens will be generated.
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input, boolean dontGenerateNewIds) throws TokenizerException;
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/DummyQueryStorage.java
// public class DummyQueryStorage implements QueryStorage {
// @Override
// public void addQuery(Integer queryId, String json) {
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return new HashSet<Map.Entry<Integer, String>>();
// }
//
// @Override
// public void deleteQuery(Integer queryId) {
// }
//
// @Override
// public void close() {
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return null;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/MapDBStore.java
// public class MapDBStore implements QueryStorage {
// private static final Logger LOGGER = LoggerFactory.getLogger(MapDBStore.class);
//
// private static final int DEFAULT_UNWRITTEN_CHANGES_LIMIT = 10000;
// private final DB database;
// private final HTreeMap<Integer, String> map;
// private int unwrittenChangesCount;
// private final int unwrittenChangesLimit;
// private final String name;
//
// public MapDBStore(File file) {
// name = file.getName();
// LOGGER.debug("opening query store " + name);
// database = DBMaker.newFileDB(file).make();
// LOGGER.debug("reading query store " + name);
// map = database.getHashMap("queries");
// unwrittenChangesCount = 0;
// unwrittenChangesLimit = DEFAULT_UNWRITTEN_CHANGES_LIMIT;
// }
//
// @Override
// public void addQuery(Integer queryId, String json) {
// map.put(queryId, json);
// commitIfNecessary();
// }
//
// private void commitIfNecessary() {
// unwrittenChangesCount++;
// if (unwrittenChangesCount >= unwrittenChangesLimit) {
// LOGGER.debug("committing changes in query store (auto-commit limit reached)");
// unwrittenChangesCount = 0;
// database.commit();
// }
// }
//
// public void deleteQuery(Integer queryId) {
// map.remove(queryId);
// commitIfNecessary();
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return map.entrySet();
// }
//
// @Override
// public void close() {
// LOGGER.debug("closing query store: " + name);
// database.commit();
// database.close();
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return map.get(queryId);
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import de.danielbasedow.prospecter.core.analysis.Analyzer;
import de.danielbasedow.prospecter.core.index.*;
import de.danielbasedow.prospecter.core.persistence.DummyQueryStorage;
import de.danielbasedow.prospecter.core.persistence.MapDBStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Map;
|
Iterator<Map.Entry<String, JsonNode>> iterator = fields.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
FieldIndex index = buildField(entry.getKey(), entry.getValue());
schema.addFieldIndex(index.getName(), index);
}
JsonNode persistence = root.get("persistence");
//as a default set DummyQueryStorage. Only if persistence options are provided overwrite it
schema.setQueryStorage(new DummyQueryStorage());
if (persistence != null && persistence.getNodeType() == JsonNodeType.OBJECT) {
//if persistence key doesn't exist there is no persistence
JsonNode file = persistence.get("file");
if (file != null && file.getNodeType() == JsonNodeType.STRING) {
schema.setQueryStorage(new MapDBStore(new File(schemaDirectory, file.asText())));
} else {
LOGGER.error("unable to get file name for query storage. Continuing with no persistence!");
}
}
} catch (Exception e) {
throw new SchemaConfigurationError("Could not parse JSON tree", e);
}
schema.init();
}
protected FieldIndex buildField(String fieldName, JsonNode node) throws SchemaConfigurationError {
FieldIndex index = null;
String type = node.get("type").asText();
LOGGER.debug("building field '" + fieldName + "' with type: '" + type + "'");
if ("FullText".equals(type)) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/analysis/Analyzer.java
// public interface Analyzer {
// /**
// * Tokenizes raw input
// *
// * @param input raw String that should be turned into tokens
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input) throws TokenizerException;
//
// /**
// * Tokenizes raw input. It is possible to turn off generating formerly unknown tokens. This makes sense when
// * tokenizing documents, as any token in a document has to have been already seen in a query to have any chance
// * of matching.
// *
// * @param input raw String that should be turned into tokens
// * @param dontGenerateNewIds if set to true no new tokens will be generated.
// * @return list of tokens
// * @throws TokenizerException
// */
// public List<Token> tokenize(String input, boolean dontGenerateNewIds) throws TokenizerException;
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/DummyQueryStorage.java
// public class DummyQueryStorage implements QueryStorage {
// @Override
// public void addQuery(Integer queryId, String json) {
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return new HashSet<Map.Entry<Integer, String>>();
// }
//
// @Override
// public void deleteQuery(Integer queryId) {
// }
//
// @Override
// public void close() {
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return null;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/persistence/MapDBStore.java
// public class MapDBStore implements QueryStorage {
// private static final Logger LOGGER = LoggerFactory.getLogger(MapDBStore.class);
//
// private static final int DEFAULT_UNWRITTEN_CHANGES_LIMIT = 10000;
// private final DB database;
// private final HTreeMap<Integer, String> map;
// private int unwrittenChangesCount;
// private final int unwrittenChangesLimit;
// private final String name;
//
// public MapDBStore(File file) {
// name = file.getName();
// LOGGER.debug("opening query store " + name);
// database = DBMaker.newFileDB(file).make();
// LOGGER.debug("reading query store " + name);
// map = database.getHashMap("queries");
// unwrittenChangesCount = 0;
// unwrittenChangesLimit = DEFAULT_UNWRITTEN_CHANGES_LIMIT;
// }
//
// @Override
// public void addQuery(Integer queryId, String json) {
// map.put(queryId, json);
// commitIfNecessary();
// }
//
// private void commitIfNecessary() {
// unwrittenChangesCount++;
// if (unwrittenChangesCount >= unwrittenChangesLimit) {
// LOGGER.debug("committing changes in query store (auto-commit limit reached)");
// unwrittenChangesCount = 0;
// database.commit();
// }
// }
//
// public void deleteQuery(Integer queryId) {
// map.remove(queryId);
// commitIfNecessary();
// }
//
// @Override
// public Set<Map.Entry<Integer, String>> getAllQueries() {
// return map.entrySet();
// }
//
// @Override
// public void close() {
// LOGGER.debug("closing query store: " + name);
// database.commit();
// database.close();
// }
//
// @Override
// public String getRawQuery(Integer queryId) {
// return map.get(queryId);
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSON.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import de.danielbasedow.prospecter.core.analysis.Analyzer;
import de.danielbasedow.prospecter.core.index.*;
import de.danielbasedow.prospecter.core.persistence.DummyQueryStorage;
import de.danielbasedow.prospecter.core.persistence.MapDBStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Map;
Iterator<Map.Entry<String, JsonNode>> iterator = fields.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
FieldIndex index = buildField(entry.getKey(), entry.getValue());
schema.addFieldIndex(index.getName(), index);
}
JsonNode persistence = root.get("persistence");
//as a default set DummyQueryStorage. Only if persistence options are provided overwrite it
schema.setQueryStorage(new DummyQueryStorage());
if (persistence != null && persistence.getNodeType() == JsonNodeType.OBJECT) {
//if persistence key doesn't exist there is no persistence
JsonNode file = persistence.get("file");
if (file != null && file.getNodeType() == JsonNodeType.STRING) {
schema.setQueryStorage(new MapDBStore(new File(schemaDirectory, file.asText())));
} else {
LOGGER.error("unable to get file name for query storage. Continuing with no persistence!");
}
}
} catch (Exception e) {
throw new SchemaConfigurationError("Could not parse JSON tree", e);
}
schema.init();
}
protected FieldIndex buildField(String fieldName, JsonNode node) throws SchemaConfigurationError {
FieldIndex index = null;
String type = node.get("type").asText();
LOGGER.debug("building field '" + fieldName + "' with type: '" + type + "'");
if ("FullText".equals(type)) {
|
Analyzer analyzer;
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/server/Server.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Instance.java
// public class Instance {
// private final String homeDirectory;
// private static final Logger LOGGER = LoggerFactory.getLogger(Instance.class);
// private final Map<String, Schema> schemas;
//
// public Instance(String homeDirectory) {
// this.homeDirectory = homeDirectory;
// schemas = new HashMap<String, Schema>();
// }
//
// public void initialize() throws SchemaConfigurationError {
// File dir = new File(homeDirectory);
// if (!dir.isDirectory() || !dir.canRead()) {
// LOGGER.error("Can't open home directory '" + homeDirectory + "' make sure it is a directory and readable.");
// throw new SchemaConfigurationError("Can't read home directory");
// }
//
// File[] files = dir.listFiles();
// if (files == null) {
// LOGGER.error("Error reading home directory. Make sure it is not empty.");
// throw new SchemaConfigurationError("No files in home directory");
// }
// for (File file : files) {
// if (file.isDirectory() && file.canRead()) {
// File[] schemaFiles = file.listFiles(new FilenameFilter() {
// @Override
// public boolean accept(File dir, String name) {
// return "schema.json".equals(name);
// }
// });
// if (schemaFiles.length == 1) {
// LOGGER.info("Found schema.json in '" + file.getAbsoluteFile() + "'");
// //directory name is schema name
// String schemaName = file.getName();
// SchemaBuilder schemaBuilder = new SchemaBuilderJSON(schemaFiles[0]);
// schemas.put(schemaName, schemaBuilder.getSchema());
// }
// }
// }
// }
//
// public void shutDown() {
// for (Map.Entry<String, Schema> entry : schemas.entrySet()) {
// Schema schema = entry.getValue();
// if (schema != null) {
// schema.close();
// }
// }
// }
//
// public Schema getSchema(String name) {
// Schema schema = schemas.get(name);
// if (schema == null) {
// throw new SchemaNotFoundException("Schema '" + name + "' unknown.");
// }
// return schema;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/schema/SchemaConfigurationError.java
// public class SchemaConfigurationError extends Exception {
// public SchemaConfigurationError(String msg) {
// super(msg);
// }
//
// public SchemaConfigurationError(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
|
import com.fasterxml.jackson.databind.ObjectMapper;
import de.danielbasedow.prospecter.core.Instance;
import de.danielbasedow.prospecter.core.schema.SchemaConfigurationError;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
|
package de.danielbasedow.prospecter.server;
public class Server {
private static final Logger LOGGER = LoggerFactory.getLogger(Server.class);
public static void main(String[] args) {
ObjectMapper mapper = new ObjectMapper();
ServerConfig config;
try {
config = mapper.readValue(new File(args[0]), ServerConfig.class);
} catch (IOException e) {
LOGGER.error("unable to read config file '" + args[0] + "'", e);
return;
}
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Instance.java
// public class Instance {
// private final String homeDirectory;
// private static final Logger LOGGER = LoggerFactory.getLogger(Instance.class);
// private final Map<String, Schema> schemas;
//
// public Instance(String homeDirectory) {
// this.homeDirectory = homeDirectory;
// schemas = new HashMap<String, Schema>();
// }
//
// public void initialize() throws SchemaConfigurationError {
// File dir = new File(homeDirectory);
// if (!dir.isDirectory() || !dir.canRead()) {
// LOGGER.error("Can't open home directory '" + homeDirectory + "' make sure it is a directory and readable.");
// throw new SchemaConfigurationError("Can't read home directory");
// }
//
// File[] files = dir.listFiles();
// if (files == null) {
// LOGGER.error("Error reading home directory. Make sure it is not empty.");
// throw new SchemaConfigurationError("No files in home directory");
// }
// for (File file : files) {
// if (file.isDirectory() && file.canRead()) {
// File[] schemaFiles = file.listFiles(new FilenameFilter() {
// @Override
// public boolean accept(File dir, String name) {
// return "schema.json".equals(name);
// }
// });
// if (schemaFiles.length == 1) {
// LOGGER.info("Found schema.json in '" + file.getAbsoluteFile() + "'");
// //directory name is schema name
// String schemaName = file.getName();
// SchemaBuilder schemaBuilder = new SchemaBuilderJSON(schemaFiles[0]);
// schemas.put(schemaName, schemaBuilder.getSchema());
// }
// }
// }
// }
//
// public void shutDown() {
// for (Map.Entry<String, Schema> entry : schemas.entrySet()) {
// Schema schema = entry.getValue();
// if (schema != null) {
// schema.close();
// }
// }
// }
//
// public Schema getSchema(String name) {
// Schema schema = schemas.get(name);
// if (schema == null) {
// throw new SchemaNotFoundException("Schema '" + name + "' unknown.");
// }
// return schema;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/schema/SchemaConfigurationError.java
// public class SchemaConfigurationError extends Exception {
// public SchemaConfigurationError(String msg) {
// super(msg);
// }
//
// public SchemaConfigurationError(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/server/Server.java
import com.fasterxml.jackson.databind.ObjectMapper;
import de.danielbasedow.prospecter.core.Instance;
import de.danielbasedow.prospecter.core.schema.SchemaConfigurationError;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
package de.danielbasedow.prospecter.server;
public class Server {
private static final Logger LOGGER = LoggerFactory.getLogger(Server.class);
public static void main(String[] args) {
ObjectMapper mapper = new ObjectMapper();
ServerConfig config;
try {
config = mapper.readValue(new File(args[0]), ServerConfig.class);
} catch (IOException e) {
LOGGER.error("unable to read config file '" + args[0] + "'", e);
return;
}
|
final Instance instance = new Instance(config.getHomeDir());
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/server/Server.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Instance.java
// public class Instance {
// private final String homeDirectory;
// private static final Logger LOGGER = LoggerFactory.getLogger(Instance.class);
// private final Map<String, Schema> schemas;
//
// public Instance(String homeDirectory) {
// this.homeDirectory = homeDirectory;
// schemas = new HashMap<String, Schema>();
// }
//
// public void initialize() throws SchemaConfigurationError {
// File dir = new File(homeDirectory);
// if (!dir.isDirectory() || !dir.canRead()) {
// LOGGER.error("Can't open home directory '" + homeDirectory + "' make sure it is a directory and readable.");
// throw new SchemaConfigurationError("Can't read home directory");
// }
//
// File[] files = dir.listFiles();
// if (files == null) {
// LOGGER.error("Error reading home directory. Make sure it is not empty.");
// throw new SchemaConfigurationError("No files in home directory");
// }
// for (File file : files) {
// if (file.isDirectory() && file.canRead()) {
// File[] schemaFiles = file.listFiles(new FilenameFilter() {
// @Override
// public boolean accept(File dir, String name) {
// return "schema.json".equals(name);
// }
// });
// if (schemaFiles.length == 1) {
// LOGGER.info("Found schema.json in '" + file.getAbsoluteFile() + "'");
// //directory name is schema name
// String schemaName = file.getName();
// SchemaBuilder schemaBuilder = new SchemaBuilderJSON(schemaFiles[0]);
// schemas.put(schemaName, schemaBuilder.getSchema());
// }
// }
// }
// }
//
// public void shutDown() {
// for (Map.Entry<String, Schema> entry : schemas.entrySet()) {
// Schema schema = entry.getValue();
// if (schema != null) {
// schema.close();
// }
// }
// }
//
// public Schema getSchema(String name) {
// Schema schema = schemas.get(name);
// if (schema == null) {
// throw new SchemaNotFoundException("Schema '" + name + "' unknown.");
// }
// return schema;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/schema/SchemaConfigurationError.java
// public class SchemaConfigurationError extends Exception {
// public SchemaConfigurationError(String msg) {
// super(msg);
// }
//
// public SchemaConfigurationError(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
|
import com.fasterxml.jackson.databind.ObjectMapper;
import de.danielbasedow.prospecter.core.Instance;
import de.danielbasedow.prospecter.core.schema.SchemaConfigurationError;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
|
LOGGER.error("unable to read config file '" + args[0] + "'", e);
return;
}
final Instance instance = new Instance(config.getHomeDir());
final EventLoopGroup boss = new NioEventLoopGroup(1);
final EventLoopGroup worker = new NioEventLoopGroup();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
LOGGER.info("shutting down");
boss.shutdownGracefully();
worker.shutdownGracefully();
instance.shutDown();
}
});
try {
instance.initialize();
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.option(ChannelOption.SO_BACKLOG, 1024);
bootstrap.group(boss, worker)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new HttpApiServerInitializer(instance));
Channel channel = bootstrap.bind(config.getBindInterface(), config.getPort()).sync().channel();
channel.closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Instance.java
// public class Instance {
// private final String homeDirectory;
// private static final Logger LOGGER = LoggerFactory.getLogger(Instance.class);
// private final Map<String, Schema> schemas;
//
// public Instance(String homeDirectory) {
// this.homeDirectory = homeDirectory;
// schemas = new HashMap<String, Schema>();
// }
//
// public void initialize() throws SchemaConfigurationError {
// File dir = new File(homeDirectory);
// if (!dir.isDirectory() || !dir.canRead()) {
// LOGGER.error("Can't open home directory '" + homeDirectory + "' make sure it is a directory and readable.");
// throw new SchemaConfigurationError("Can't read home directory");
// }
//
// File[] files = dir.listFiles();
// if (files == null) {
// LOGGER.error("Error reading home directory. Make sure it is not empty.");
// throw new SchemaConfigurationError("No files in home directory");
// }
// for (File file : files) {
// if (file.isDirectory() && file.canRead()) {
// File[] schemaFiles = file.listFiles(new FilenameFilter() {
// @Override
// public boolean accept(File dir, String name) {
// return "schema.json".equals(name);
// }
// });
// if (schemaFiles.length == 1) {
// LOGGER.info("Found schema.json in '" + file.getAbsoluteFile() + "'");
// //directory name is schema name
// String schemaName = file.getName();
// SchemaBuilder schemaBuilder = new SchemaBuilderJSON(schemaFiles[0]);
// schemas.put(schemaName, schemaBuilder.getSchema());
// }
// }
// }
// }
//
// public void shutDown() {
// for (Map.Entry<String, Schema> entry : schemas.entrySet()) {
// Schema schema = entry.getValue();
// if (schema != null) {
// schema.close();
// }
// }
// }
//
// public Schema getSchema(String name) {
// Schema schema = schemas.get(name);
// if (schema == null) {
// throw new SchemaNotFoundException("Schema '" + name + "' unknown.");
// }
// return schema;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/schema/SchemaConfigurationError.java
// public class SchemaConfigurationError extends Exception {
// public SchemaConfigurationError(String msg) {
// super(msg);
// }
//
// public SchemaConfigurationError(String msg, Throwable cause) {
// super(msg, cause);
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/server/Server.java
import com.fasterxml.jackson.databind.ObjectMapper;
import de.danielbasedow.prospecter.core.Instance;
import de.danielbasedow.prospecter.core.schema.SchemaConfigurationError;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
LOGGER.error("unable to read config file '" + args[0] + "'", e);
return;
}
final Instance instance = new Instance(config.getHomeDir());
final EventLoopGroup boss = new NioEventLoopGroup(1);
final EventLoopGroup worker = new NioEventLoopGroup();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
LOGGER.info("shutting down");
boss.shutdownGracefully();
worker.shutdownGracefully();
instance.shutDown();
}
});
try {
instance.initialize();
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.option(ChannelOption.SO_BACKLOG, 1024);
bootstrap.group(boss, worker)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new HttpApiServerInitializer(instance));
Channel channel = bootstrap.bind(config.getBindInterface(), config.getPort()).sync().channel();
channel.closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
|
} catch (SchemaConfigurationError e) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/RangeIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;
|
package de.danielbasedow.prospecter.core.index;
public class RangeIndex<T> {
protected final SortedMap<T, TLongList> indexEquals = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexLessThan = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexGreaterThan = new ConcurrentSkipListMap<T, TLongList>();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/RangeIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;
package de.danielbasedow.prospecter.core.index;
public class RangeIndex<T> {
protected final SortedMap<T, TLongList> indexEquals = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexLessThan = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexGreaterThan = new ConcurrentSkipListMap<T, TLongList>();
|
public void match(Field field, Matcher matcher) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/RangeIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;
|
package de.danielbasedow.prospecter.core.index;
public class RangeIndex<T> {
protected final SortedMap<T, TLongList> indexEquals = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexLessThan = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexGreaterThan = new ConcurrentSkipListMap<T, TLongList>();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/RangeIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;
package de.danielbasedow.prospecter.core.index;
public class RangeIndex<T> {
protected final SortedMap<T, TLongList> indexEquals = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexLessThan = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexGreaterThan = new ConcurrentSkipListMap<T, TLongList>();
|
public void match(Field field, Matcher matcher) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/RangeIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;
|
package de.danielbasedow.prospecter.core.index;
public class RangeIndex<T> {
protected final SortedMap<T, TLongList> indexEquals = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexLessThan = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexGreaterThan = new ConcurrentSkipListMap<T, TLongList>();
public void match(Field field, Matcher matcher) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/RangeIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TLongArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentSkipListMap;
package de.danielbasedow.prospecter.core.index;
public class RangeIndex<T> {
protected final SortedMap<T, TLongList> indexEquals = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexLessThan = new ConcurrentSkipListMap<T, TLongList>();
protected final SortedMap<T, TLongList> indexGreaterThan = new ConcurrentSkipListMap<T, TLongList>();
public void match(Field field, Matcher matcher) {
|
List<Token> tokens = field.getTokens();
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/AbstractRangeFieldIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
|
package de.danielbasedow.prospecter.core.index;
public abstract class AbstractRangeFieldIndex<T> extends AbstractFieldIndex {
protected final RangeIndex<T> index = new RangeIndex<T>();
public AbstractRangeFieldIndex(String name) {
super(name);
}
@Override
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/AbstractRangeFieldIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
package de.danielbasedow.prospecter.core.index;
public abstract class AbstractRangeFieldIndex<T> extends AbstractFieldIndex {
protected final RangeIndex<T> index = new RangeIndex<T>();
public AbstractRangeFieldIndex(String name) {
super(name);
}
@Override
|
public void match(Field field, Matcher matcher) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/AbstractRangeFieldIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
|
package de.danielbasedow.prospecter.core.index;
public abstract class AbstractRangeFieldIndex<T> extends AbstractFieldIndex {
protected final RangeIndex<T> index = new RangeIndex<T>();
public AbstractRangeFieldIndex(String name) {
super(name);
}
@Override
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/AbstractRangeFieldIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
package de.danielbasedow.prospecter.core.index;
public abstract class AbstractRangeFieldIndex<T> extends AbstractFieldIndex {
protected final RangeIndex<T> index = new RangeIndex<T>();
public AbstractRangeFieldIndex(String name) {
super(name);
}
@Override
|
public void match(Field field, Matcher matcher) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/AbstractRangeFieldIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
|
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
|
package de.danielbasedow.prospecter.core.index;
public abstract class AbstractRangeFieldIndex<T> extends AbstractFieldIndex {
protected final RangeIndex<T> index = new RangeIndex<T>();
public AbstractRangeFieldIndex(String name) {
super(name);
}
@Override
public void match(Field field, Matcher matcher) {
index.match(field, matcher);
}
@Override
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Matcher.java
// public class Matcher {
// protected final TIntObjectHashMap<BitSet> hits = new TIntObjectHashMap<BitSet>();
// protected final TIntObjectHashMap<QueryNegativeCounter> negativeHits = new TIntObjectHashMap<QueryNegativeCounter>();
//
// protected final QueryManager queryManager;
//
// public Matcher(QueryManager qm) {
// queryManager = qm;
// }
//
// public void addHits(TLongList postings) {
// postings.forEach(new TLongProcedure() {
// @Override
// public boolean execute(long posting) {
// addHit(posting);
// return true;
// }
// });
// }
//
// public void addHit(long posting) {
// int[] unpacked = QueryPosting.unpack(posting);
// int queryId = unpacked[QueryPosting.QUERY_ID_INDEX];
//
// if (unpacked[QueryPosting.QUERY_NOT_INDEX] == 1) {
// QueryNegativeCounter counter = negativeHits.get(queryId);
// if (counter == null) {
// counter = new QueryNegativeCounter();
// negativeHits.put(queryId, counter);
// }
// counter.add(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// } else {
// BitSet bits = hits.get(queryId);
// if (bits == null) {
// bits = new BitSet();
// hits.put(queryId, bits);
// }
// bits.set(unpacked[QueryPosting.QUERY_BIT_INDEX]);
// }
// }
//
// public int getPositiveMatchCount() {
// return hits.size();
// }
//
// public int getNegativeMatchCount() {
// return negativeHits.size();
// }
//
// public List<Integer> getMatchedQueries() {
// final List<Integer> results = new ArrayList<Integer>();
//
// hits.forEachEntry(new TIntObjectProcedure<BitSet>() {
// @Override
// public boolean execute(int queryId, BitSet bitSet) {
// BitSet mask = queryManager.getMask(queryId);
// if (mask != null) {
// if (mask.equals(bitSet)) {
// results.add(queryId);
// } else {
// QueryNegativeCounter countMask = queryManager.getQueryNegativeCounter(queryId);
// if (countMask != null) {
// QueryNegativeCounter actualCount = negativeHits.get(queryId);
// if (actualCount == null) {
// actualCount = new QueryNegativeCounter();
// }
// int[] bitPositions = countMask.getBitPositionsToSet(actualCount);
// if (bitPositions.length > 0) {
// for (int position : bitPositions) {
// bitSet.set(position, true);
// }
// }
// if (mask.equals(bitSet)) {
// results.add(queryId);
// }
// }
// }
// }
// return true;
// }
// });
// return results;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/document/Field.java
// public class Field {
// protected final String name;
// protected final List<Token> tokens;
//
// /**
// * @param name name of the field
// * @param tokens List of tokens in the field
// */
// public Field(String name, List<Token> tokens) {
// this.name = name;
// this.tokens = tokens;
// }
//
// public List<Token> getTokens() {
// return tokens;
// }
//
// public String getName() {
// return name;
// }
//
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/AbstractRangeFieldIndex.java
import de.danielbasedow.prospecter.core.Matcher;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.document.Field;
import gnu.trove.list.TLongList;
package de.danielbasedow.prospecter.core.index;
public abstract class AbstractRangeFieldIndex<T> extends AbstractFieldIndex {
protected final RangeIndex<T> index = new RangeIndex<T>();
public AbstractRangeFieldIndex(String name) {
super(name);
}
@Override
public void match(Field field, Matcher matcher) {
index.match(field, matcher);
}
@Override
|
public void addPosting(Token token, Long posting) {
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
|
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
|
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
|
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
conditionsA.add(new Condition("floor", new Token<Integer>(4, MatchCondition.LESS_THAN)));
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
conditionsA.add(new Condition("floor", new Token<Integer>(4, MatchCondition.LESS_THAN)));
|
Clause clauseA = new Clause(Clause.ClauseType.OR, conditionsA);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
conditionsA.add(new Condition("floor", new Token<Integer>(4, MatchCondition.LESS_THAN)));
Clause clauseA = new Clause(Clause.ClauseType.OR, conditionsA);
List<ClauseNode> conditionsB = new ArrayList<ClauseNode>();
conditionsB.add(new Condition("category", new Token<String>("foo", MatchCondition.EQUALS)));
conditionsB.add(new Condition("category", new Token<String>("bar", MatchCondition.EQUALS)));
Clause clauseB = new Clause(Clause.ClauseType.OR, conditionsB);
List<ClauseNode> clauses = new ArrayList<ClauseNode>();
clauses.add(clauseA);
clauses.add(clauseB);
Clause root = new Clause(Clause.ClauseType.OR, clauses);
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
conditionsA.add(new Condition("floor", new Token<Integer>(4, MatchCondition.LESS_THAN)));
Clause clauseA = new Clause(Clause.ClauseType.OR, conditionsA);
List<ClauseNode> conditionsB = new ArrayList<ClauseNode>();
conditionsB.add(new Condition("category", new Token<String>("foo", MatchCondition.EQUALS)));
conditionsB.add(new Condition("category", new Token<String>("bar", MatchCondition.EQUALS)));
Clause clauseB = new Clause(Clause.ClauseType.OR, conditionsB);
List<ClauseNode> clauses = new ArrayList<ClauseNode>();
clauses.add(clauseA);
clauses.add(clauseB);
Clause root = new Clause(Clause.ClauseType.OR, clauses);
|
Sentence sentence = PropositionalSentenceMapper.map(root);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
|
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
conditionsA.add(new Condition("floor", new Token<Integer>(4, MatchCondition.LESS_THAN)));
Clause clauseA = new Clause(Clause.ClauseType.OR, conditionsA);
List<ClauseNode> conditionsB = new ArrayList<ClauseNode>();
conditionsB.add(new Condition("category", new Token<String>("foo", MatchCondition.EQUALS)));
conditionsB.add(new Condition("category", new Token<String>("bar", MatchCondition.EQUALS)));
Clause clauseB = new Clause(Clause.ClauseType.OR, conditionsB);
List<ClauseNode> clauses = new ArrayList<ClauseNode>();
clauses.add(clauseA);
clauses.add(clauseB);
Clause root = new Clause(Clause.ClauseType.OR, clauses);
Sentence sentence = PropositionalSentenceMapper.map(root);
assertEquals(Connective.OR, sentence.getConnective());
assertEquals(2, sentence.getNumberSimplerSentences());
Sentence cnf = Query.getCNF(sentence);
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Clause.java
// public class Clause implements ClauseNode {
//
// public static enum ClauseType {
// AND,
// OR,
// NOT
// }
//
// private final ClauseType type;
// private final List<ClauseNode> subClauses;
//
// public Clause(ClauseType type, List<ClauseNode> clauses) {
// this.type = type;
// this.subClauses = clauses;
// }
//
// @Override
// public boolean isLeaf() {
// return false;
// }
//
// public List<ClauseNode> getSubClauses() {
// return subClauses;
// }
//
// public ClauseType getType() {
// return type;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/Conjunction.java
// public class Conjunction extends FlatComplexSentence {
//
// @Override
// public Connective getConnective() {
// return Connective.AND;
// }
//
// public boolean isAndSentence() {
// return true;
// }
//
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/PropositionalSentenceMapper.java
// public class PropositionalSentenceMapper {
// public static Sentence map(ClauseNode clause) {
// if (!clause.isLeaf()) {
// return mapAsComplexSentence((Clause) clause);
// } else {
// return mapAsAtomicSentence((Condition) clause);
// }
// }
//
// private static Sentence mapAsAtomicSentence(Condition clause) {
// return new PropositionSymbol(clause);
// }
//
// private static Sentence mapAsComplexSentence(Clause clause) {
// ArrayList<Sentence> subSentences = new ArrayList<Sentence>();
// for (ClauseNode clauseNode : clause.getSubClauses()) {
// subSentences.add(map(clauseNode));
// }
//
// Connective connective;
// switch (clause.getType()) {
// case AND:
// connective = Connective.AND;
// break;
// case OR:
// connective = Connective.OR;
// break;
// case NOT:
// connective = Connective.NOT;
// break;
// default:
// connective = Connective.AND;
// }
//
// return bracketIfNecessary(connective, subSentences);
// }
//
// private static Sentence bracketIfNecessary(Connective connective, List<Sentence> sentences) {
// if (connective == Connective.NOT && sentences.size() == 1) {
// return new ComplexSentence(connective, sentences.get(0));
// }
// while (sentences.size() > 1) {
// ComplexSentence newComplex = new ComplexSentence(
// connective,
// sentences.remove(sentences.size() - 1),
// sentences.remove(sentences.size() - 1)
// );
// sentences.add(newComplex);
// }
// return sentences.get(0);
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/query/QueryTest.java
import aima.core.logic.propositional.parsing.ast.Connective;
import aima.core.logic.propositional.parsing.ast.Sentence;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.Clause;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
import de.danielbasedow.prospecter.core.query.build.Conjunction;
import de.danielbasedow.prospecter.core.query.build.PropositionalSentenceMapper;
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query;
public class QueryTest extends TestCase {
public void testFlattenOr() {
List<ClauseNode> conditionsA = new ArrayList<ClauseNode>();
conditionsA.add(new Condition("price", new Token<Integer>(100, MatchCondition.GREATER_THAN_EQUALS)));
conditionsA.add(new Condition("floor", new Token<Integer>(4, MatchCondition.LESS_THAN)));
Clause clauseA = new Clause(Clause.ClauseType.OR, conditionsA);
List<ClauseNode> conditionsB = new ArrayList<ClauseNode>();
conditionsB.add(new Condition("category", new Token<String>("foo", MatchCondition.EQUALS)));
conditionsB.add(new Condition("category", new Token<String>("bar", MatchCondition.EQUALS)));
Clause clauseB = new Clause(Clause.ClauseType.OR, conditionsB);
List<ClauseNode> clauses = new ArrayList<ClauseNode>();
clauses.add(clauseA);
clauses.add(clauseB);
Clause root = new Clause(Clause.ClauseType.OR, clauses);
Sentence sentence = PropositionalSentenceMapper.map(root);
assertEquals(Connective.OR, sentence.getConnective());
assertEquals(2, sentence.getNumberSimplerSentences());
Sentence cnf = Query.getCNF(sentence);
|
Conjunction conjunction = new Conjunction();
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/build/GenericFieldHandler.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.Condition;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query.build;
public abstract class GenericFieldHandler extends AbstractFieldHandler {
public GenericFieldHandler(ObjectNode node, String fieldName) {
super(node, fieldName);
}
public List<ClauseNode> getConditions() {
List<ClauseNode> conditions = new ArrayList<ClauseNode>();
String comparator = root.get("condition").asText();
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/GenericFieldHandler.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.Condition;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query.build;
public abstract class GenericFieldHandler extends AbstractFieldHandler {
public GenericFieldHandler(ObjectNode node, String fieldName) {
super(node, fieldName);
}
public List<ClauseNode> getConditions() {
List<ClauseNode> conditions = new ArrayList<ClauseNode>();
String comparator = root.get("condition").asText();
|
MatchCondition matchCondition = getMatchCondition(comparator);
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/build/GenericFieldHandler.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.Condition;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query.build;
public abstract class GenericFieldHandler extends AbstractFieldHandler {
public GenericFieldHandler(ObjectNode node, String fieldName) {
super(node, fieldName);
}
public List<ClauseNode> getConditions() {
List<ClauseNode> conditions = new ArrayList<ClauseNode>();
String comparator = root.get("condition").asText();
MatchCondition matchCondition = getMatchCondition(comparator);
boolean not = false;
if (root.get("not") != null) {
not = root.get("not").asBoolean(false);
}
JsonNode valNode = getValue();
if (valNode.getNodeType() == JsonNodeType.ARRAY) {
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/GenericFieldHandler.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.Condition;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query.build;
public abstract class GenericFieldHandler extends AbstractFieldHandler {
public GenericFieldHandler(ObjectNode node, String fieldName) {
super(node, fieldName);
}
public List<ClauseNode> getConditions() {
List<ClauseNode> conditions = new ArrayList<ClauseNode>();
String comparator = root.get("condition").asText();
MatchCondition matchCondition = getMatchCondition(comparator);
boolean not = false;
if (root.get("not") != null) {
not = root.get("not").asBoolean(false);
}
JsonNode valNode = getValue();
if (valNode.getNodeType() == JsonNodeType.ARRAY) {
|
List<Token> tokens = new ArrayList<Token>();
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/build/GenericFieldHandler.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
|
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.Condition;
import java.util.ArrayList;
import java.util.List;
|
package de.danielbasedow.prospecter.core.query.build;
public abstract class GenericFieldHandler extends AbstractFieldHandler {
public GenericFieldHandler(ObjectNode node, String fieldName) {
super(node, fieldName);
}
public List<ClauseNode> getConditions() {
List<ClauseNode> conditions = new ArrayList<ClauseNode>();
String comparator = root.get("condition").asText();
MatchCondition matchCondition = getMatchCondition(comparator);
boolean not = false;
if (root.get("not") != null) {
not = root.get("not").asBoolean(false);
}
JsonNode valNode = getValue();
if (valNode.getNodeType() == JsonNodeType.ARRAY) {
List<Token> tokens = new ArrayList<Token>();
for (JsonNode node : valNode) {
tokens.add(getToken(node, matchCondition));
}
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
// public class Condition implements ClauseNode {
// private final String fieldName;
// private final Token token;
//
// /**
// * if "not" is set the condition will result in a posting in a "NOT-index"
// */
// private boolean not;
//
// public Condition(String fieldName, Token token) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = false;
// }
//
// public Condition(String fieldName, Token token, boolean not) {
// this.fieldName = fieldName;
// this.token = token;
// this.not = not;
// }
//
// public String getFieldName() {
// return fieldName;
// }
//
// public Token getToken() {
// return token;
// }
//
// public boolean isNot() {
// return not;
// }
//
// public void setNot(boolean not) {
// this.not = not;
// }
//
// @Override
// public boolean isLeaf() {
// return true;
// }
//
// /**
// * AIMA symbols need a unique, java conform name
// *
// * @return symbol name for use in AIMA
// */
// public String getSymbolName() {
// return fieldName + token.getCondition().name() + token.getToken().toString();
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/GenericFieldHandler.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.Condition;
import java.util.ArrayList;
import java.util.List;
package de.danielbasedow.prospecter.core.query.build;
public abstract class GenericFieldHandler extends AbstractFieldHandler {
public GenericFieldHandler(ObjectNode node, String fieldName) {
super(node, fieldName);
}
public List<ClauseNode> getConditions() {
List<ClauseNode> conditions = new ArrayList<ClauseNode>();
String comparator = root.get("condition").asText();
MatchCondition matchCondition = getMatchCondition(comparator);
boolean not = false;
if (root.get("not") != null) {
not = root.get("not").asBoolean(false);
}
JsonNode valNode = getValue();
if (valNode.getNodeType() == JsonNodeType.ARRAY) {
List<Token> tokens = new ArrayList<Token>();
for (JsonNode node : valNode) {
tokens.add(getToken(node, matchCondition));
}
|
conditions.add(new Condition(fieldName, new Token<List<Token>>(tokens, MatchCondition.IN), not));
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/index/AbstractFieldIndex.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import de.danielbasedow.prospecter.core.Token;
|
package de.danielbasedow.prospecter.core.index;
/**
* Abstract class for FieldIndex implementations.
*/
public abstract class AbstractFieldIndex implements FieldIndex {
protected final String name;
public AbstractFieldIndex(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
@Override
public void trim() {
}
@Override
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/index/AbstractFieldIndex.java
import de.danielbasedow.prospecter.core.Token;
package de.danielbasedow.prospecter.core.index;
/**
* Abstract class for FieldIndex implementations.
*/
public abstract class AbstractFieldIndex implements FieldIndex {
protected final String name;
public AbstractFieldIndex(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
@Override
public void trim() {
}
@Override
|
public void removePosting(Token token, Long posting) {
|
dbasedow/prospecter
|
src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
|
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
|
package de.danielbasedow.prospecter.core.query;
/**
* A Condition is represented by a field name and token combination.
*/
public class Condition implements ClauseNode {
private final String fieldName;
|
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/build/ClauseNode.java
// public interface ClauseNode {
// public boolean isLeaf();
// }
// Path: src/main/java/de/danielbasedow/prospecter/core/query/Condition.java
import de.danielbasedow.prospecter.core.Token;
import de.danielbasedow.prospecter.core.query.build.ClauseNode;
package de.danielbasedow.prospecter.core.query;
/**
* A Condition is represented by a field name and token combination.
*/
public class Condition implements ClauseNode {
private final String fieldName;
|
private final Token token;
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/index/FullTextIndexTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core.index;
public class FullTextIndexTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
assertEquals(0, ft.index.size());
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/index/FullTextIndexTest.java
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.index;
public class FullTextIndexTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
assertEquals(0, ft.index.size());
|
Token token = new Token<Integer>(1, MatchCondition.EQUALS);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/index/FullTextIndexTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core.index;
public class FullTextIndexTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
assertEquals(0, ft.index.size());
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/index/FullTextIndexTest.java
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.index;
public class FullTextIndexTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
assertEquals(0, ft.index.size());
|
Token token = new Token<Integer>(1, MatchCondition.EQUALS);
|
dbasedow/prospecter
|
src/test/java/de/danielbasedow/prospecter/core/index/FullTextIndexTest.java
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
|
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
|
package de.danielbasedow.prospecter.core.index;
public class FullTextIndexTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
assertEquals(0, ft.index.size());
Token token = new Token<Integer>(1, MatchCondition.EQUALS);
|
// Path: src/main/java/de/danielbasedow/prospecter/core/MatchCondition.java
// public enum MatchCondition {
// EQUALS,
// LESS_THAN,
// GREATER_THAN,
// LESS_THAN_EQUALS,
// GREATER_THAN_EQUALS,
// NONE,
// IN,
// RADIUS
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/query/QueryPosting.java
// public class QueryPosting {
// public static final int QUERY_ID_INDEX = 0;
// public static final int QUERY_BIT_INDEX = 1;
// public static final int QUERY_NOT_INDEX = 2;
//
// private final int queryId;
// private final short queryBit;
//
// public QueryPosting(int queryId, short queryBit) {
// this.queryId = queryId;
// this.queryBit = queryBit;
// }
//
// public int getQueryId() {
// return queryId;
// }
//
// public short getQueryBit() {
// return queryBit;
// }
//
// public long getPackedPosting() {
// return pack(queryId, queryBit, false);
// }
//
// public static long pack(int queryId, int queryBit, boolean notFlag) {
// int not = notFlag ? 1 : 0;
//
// return (((long) queryId) << 32) | ((queryBit << 1 ) & 0xfffffffeL) | ((long) not & 0x00000001L);
// }
//
// public static int[] unpack(long posting) {
// return new int[]{
// (int) (posting >> 32),
// (int) ((posting) & 0xfffffffel) >> 1,
// (int) ((posting) & 0x00000001l)
// };
// }
// }
//
// Path: src/main/java/de/danielbasedow/prospecter/core/Token.java
// public class Token<T> {
// private final T token;
// private final MatchCondition condition;
//
// public Token(T token) {
// this(token, MatchCondition.NONE);
// }
//
// public Token(T token, MatchCondition condition) {
// this.token = token;
// this.condition = condition;
// }
//
// public T getToken() {
// return token;
// }
//
// public int hashCode() {
// return token.hashCode();
// }
//
// public boolean equals(Object compare) {
// if (compare instanceof Token) {
// return token.equals(((Token) compare).getToken());
// }
// return false;
// }
//
// public MatchCondition getCondition() {
// return condition;
// }
// }
// Path: src/test/java/de/danielbasedow/prospecter/core/index/FullTextIndexTest.java
import de.danielbasedow.prospecter.core.MatchCondition;
import de.danielbasedow.prospecter.core.query.QueryPosting;
import de.danielbasedow.prospecter.core.Token;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.index;
public class FullTextIndexTest extends TestCase {
public void test() {
FullTextIndex ft = new FullTextIndex("_all", null);
assertEquals(0, ft.index.size());
Token token = new Token<Integer>(1, MatchCondition.EQUALS);
|
ft.addPosting(token, QueryPosting.pack(1, 1, false));
|
FIXTradingCommunity/timpani
|
src/main/java/org/fixtrading/timpani/websockets/SecurityDefinitionServlet.java
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionService.java
// public interface SecurityDefinitionService extends AutoCloseable {
//
// CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest,
// Consumer<SecurityDefinitionImpl> consumer);
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionServiceImpl.java
// public class SecurityDefinitionServiceImpl implements SecurityDefinitionService {
//
// private final MongoDBSecurityDefinitionStore store = new MongoDBSecurityDefinitionStore();
// private final Logger logger;
//
//
// public SecurityDefinitionServiceImpl() throws InterruptedException, ExecutionException {
// logger = Log.getRootLogger();
// store.open().get();
// }
//
// @Override
// public void close() throws Exception {
// store.close();
// logger.info("SecurityDefinitionServiceImpl closed");
// }
//
// @Override
// public CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest, Consumer<SecurityDefinitionImpl> consumer) {
// logger.debug("SecurityDefinitionServiceImpl serving request %s", securityDefinitionRequest);
//
// return store.select(securityDefinitionRequest, sd -> {
// SecurityDefinitionImpl impl = (SecurityDefinitionImpl) sd;
// impl.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// impl.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// impl.setSecurityRequestResult(SecurityRequestResult.ValidRequest);
// consumer.accept(impl);
// }).handle((count, error) -> {
// if (error == null) {
// if (count == 0) {
// logger.debug("SecurityDefinitionServiceImpl: Zero security defintions returned" );
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.NoInstrumentsFound);
// consumer.accept(securityDefinition);
// }
// } else {
// logger.warn("SecurityDefinitionServiceImpl error %s", error.getMessage());
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.InstrumentDataTemporarilyUnavailable);
// consumer.accept(securityDefinition);
// }
// return count;
// });
// }
// }
|
import java.util.concurrent.ExecutionException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
import org.fixtrading.timpani.securitydef.SecurityDefinitionService;
import org.fixtrading.timpani.securitydef.SecurityDefinitionServiceImpl;
|
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.websockets;
/**
* Servlet implementation
* <p>
* Jetty provides the ability to wire up WebSocket endpoints to Servlet Path Specs via the use of a
* WebSocketServlet bridge servlet. Internally, Jetty manages the HTTP Upgrade to WebSocket and
* migration from a HTTP Connection to a WebSocket Connection.
*
* @author Don Mendelson
*/
// @WebServlet(urlPatterns = "/SecurityDefinitions")
public class SecurityDefinitionServlet extends WebSocketServlet {
private static final long serialVersionUID = 1L;
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionService.java
// public interface SecurityDefinitionService extends AutoCloseable {
//
// CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest,
// Consumer<SecurityDefinitionImpl> consumer);
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionServiceImpl.java
// public class SecurityDefinitionServiceImpl implements SecurityDefinitionService {
//
// private final MongoDBSecurityDefinitionStore store = new MongoDBSecurityDefinitionStore();
// private final Logger logger;
//
//
// public SecurityDefinitionServiceImpl() throws InterruptedException, ExecutionException {
// logger = Log.getRootLogger();
// store.open().get();
// }
//
// @Override
// public void close() throws Exception {
// store.close();
// logger.info("SecurityDefinitionServiceImpl closed");
// }
//
// @Override
// public CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest, Consumer<SecurityDefinitionImpl> consumer) {
// logger.debug("SecurityDefinitionServiceImpl serving request %s", securityDefinitionRequest);
//
// return store.select(securityDefinitionRequest, sd -> {
// SecurityDefinitionImpl impl = (SecurityDefinitionImpl) sd;
// impl.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// impl.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// impl.setSecurityRequestResult(SecurityRequestResult.ValidRequest);
// consumer.accept(impl);
// }).handle((count, error) -> {
// if (error == null) {
// if (count == 0) {
// logger.debug("SecurityDefinitionServiceImpl: Zero security defintions returned" );
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.NoInstrumentsFound);
// consumer.accept(securityDefinition);
// }
// } else {
// logger.warn("SecurityDefinitionServiceImpl error %s", error.getMessage());
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.InstrumentDataTemporarilyUnavailable);
// consumer.accept(securityDefinition);
// }
// return count;
// });
// }
// }
// Path: src/main/java/org/fixtrading/timpani/websockets/SecurityDefinitionServlet.java
import java.util.concurrent.ExecutionException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
import org.fixtrading.timpani.securitydef.SecurityDefinitionService;
import org.fixtrading.timpani.securitydef.SecurityDefinitionServiceImpl;
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.websockets;
/**
* Servlet implementation
* <p>
* Jetty provides the ability to wire up WebSocket endpoints to Servlet Path Specs via the use of a
* WebSocketServlet bridge servlet. Internally, Jetty manages the HTTP Upgrade to WebSocket and
* migration from a HTTP Connection to a WebSocket Connection.
*
* @author Don Mendelson
*/
// @WebServlet(urlPatterns = "/SecurityDefinitions")
public class SecurityDefinitionServlet extends WebSocketServlet {
private static final long serialVersionUID = 1L;
|
private SecurityDefinitionService service;
|
FIXTradingCommunity/timpani
|
src/main/java/org/fixtrading/timpani/websockets/SecurityDefinitionServlet.java
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionService.java
// public interface SecurityDefinitionService extends AutoCloseable {
//
// CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest,
// Consumer<SecurityDefinitionImpl> consumer);
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionServiceImpl.java
// public class SecurityDefinitionServiceImpl implements SecurityDefinitionService {
//
// private final MongoDBSecurityDefinitionStore store = new MongoDBSecurityDefinitionStore();
// private final Logger logger;
//
//
// public SecurityDefinitionServiceImpl() throws InterruptedException, ExecutionException {
// logger = Log.getRootLogger();
// store.open().get();
// }
//
// @Override
// public void close() throws Exception {
// store.close();
// logger.info("SecurityDefinitionServiceImpl closed");
// }
//
// @Override
// public CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest, Consumer<SecurityDefinitionImpl> consumer) {
// logger.debug("SecurityDefinitionServiceImpl serving request %s", securityDefinitionRequest);
//
// return store.select(securityDefinitionRequest, sd -> {
// SecurityDefinitionImpl impl = (SecurityDefinitionImpl) sd;
// impl.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// impl.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// impl.setSecurityRequestResult(SecurityRequestResult.ValidRequest);
// consumer.accept(impl);
// }).handle((count, error) -> {
// if (error == null) {
// if (count == 0) {
// logger.debug("SecurityDefinitionServiceImpl: Zero security defintions returned" );
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.NoInstrumentsFound);
// consumer.accept(securityDefinition);
// }
// } else {
// logger.warn("SecurityDefinitionServiceImpl error %s", error.getMessage());
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.InstrumentDataTemporarilyUnavailable);
// consumer.accept(securityDefinition);
// }
// return count;
// });
// }
// }
|
import java.util.concurrent.ExecutionException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
import org.fixtrading.timpani.securitydef.SecurityDefinitionService;
import org.fixtrading.timpani.securitydef.SecurityDefinitionServiceImpl;
|
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.websockets;
/**
* Servlet implementation
* <p>
* Jetty provides the ability to wire up WebSocket endpoints to Servlet Path Specs via the use of a
* WebSocketServlet bridge servlet. Internally, Jetty manages the HTTP Upgrade to WebSocket and
* migration from a HTTP Connection to a WebSocket Connection.
*
* @author Don Mendelson
*/
// @WebServlet(urlPatterns = "/SecurityDefinitions")
public class SecurityDefinitionServlet extends WebSocketServlet {
private static final long serialVersionUID = 1L;
private SecurityDefinitionService service;
private Logger logger;
@Override
public void configure(WebSocketServletFactory factory) {
logger = Log.getRootLogger();
factory.getPolicy().setIdleTimeout(120000);
// factory.register(SecurityDefSocket.class);
try {
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionService.java
// public interface SecurityDefinitionService extends AutoCloseable {
//
// CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest,
// Consumer<SecurityDefinitionImpl> consumer);
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/SecurityDefinitionServiceImpl.java
// public class SecurityDefinitionServiceImpl implements SecurityDefinitionService {
//
// private final MongoDBSecurityDefinitionStore store = new MongoDBSecurityDefinitionStore();
// private final Logger logger;
//
//
// public SecurityDefinitionServiceImpl() throws InterruptedException, ExecutionException {
// logger = Log.getRootLogger();
// store.open().get();
// }
//
// @Override
// public void close() throws Exception {
// store.close();
// logger.info("SecurityDefinitionServiceImpl closed");
// }
//
// @Override
// public CompletableFuture<Integer> serve(
// SecurityDefinitionRequest securityDefinitionRequest, Consumer<SecurityDefinitionImpl> consumer) {
// logger.debug("SecurityDefinitionServiceImpl serving request %s", securityDefinitionRequest);
//
// return store.select(securityDefinitionRequest, sd -> {
// SecurityDefinitionImpl impl = (SecurityDefinitionImpl) sd;
// impl.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// impl.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// impl.setSecurityRequestResult(SecurityRequestResult.ValidRequest);
// consumer.accept(impl);
// }).handle((count, error) -> {
// if (error == null) {
// if (count == 0) {
// logger.debug("SecurityDefinitionServiceImpl: Zero security defintions returned" );
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.NoInstrumentsFound);
// consumer.accept(securityDefinition);
// }
// } else {
// logger.warn("SecurityDefinitionServiceImpl error %s", error.getMessage());
// SecurityDefinitionImpl securityDefinition = new SecurityDefinitionImpl();
// securityDefinition.setSecurityReqID(securityDefinitionRequest.getSecurityReqID());
// securityDefinition.setSubscriptionRequestType(securityDefinitionRequest.getSubscriptionRequestType());
// securityDefinition.setSecurityRequestResult(SecurityRequestResult.InstrumentDataTemporarilyUnavailable);
// consumer.accept(securityDefinition);
// }
// return count;
// });
// }
// }
// Path: src/main/java/org/fixtrading/timpani/websockets/SecurityDefinitionServlet.java
import java.util.concurrent.ExecutionException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
import org.fixtrading.timpani.securitydef.SecurityDefinitionService;
import org.fixtrading.timpani.securitydef.SecurityDefinitionServiceImpl;
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.websockets;
/**
* Servlet implementation
* <p>
* Jetty provides the ability to wire up WebSocket endpoints to Servlet Path Specs via the use of a
* WebSocketServlet bridge servlet. Internally, Jetty manages the HTTP Upgrade to WebSocket and
* migration from a HTTP Connection to a WebSocket Connection.
*
* @author Don Mendelson
*/
// @WebServlet(urlPatterns = "/SecurityDefinitions")
public class SecurityDefinitionServlet extends WebSocketServlet {
private static final long serialVersionUID = 1L;
private SecurityDefinitionService service;
private Logger logger;
@Override
public void configure(WebSocketServletFactory factory) {
logger = Log.getRootLogger();
factory.getPolicy().setIdleTimeout(120000);
// factory.register(SecurityDefSocket.class);
try {
|
service = new SecurityDefinitionServiceImpl();
|
FIXTradingCommunity/timpani
|
src/main/java/org/fixtrading/timpani/securitydef/datastore/SecurityDefinitionStore.java
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinition.java
// public interface SecurityDefinition extends Message {
//
// interface InstrAttrib {
// // tag 871
// InstrAttribType getInstrAttribType();
//
// // tag 872
// String getInstrAttribValue();
// }
//
// interface MarketSegment {
//
// // tag 1301
// String getMarketID();
//
// // tag 1300
// String getMarketSegmentID();
// }
//
// // tag 870
// int getNoInstrAttrib();
//
// InstrAttrib getInstrAttrib(int index);
//
// // tag 1310
// int getNoMarketSegments();
//
// MarketSegment getMarketSegment(int index);
//
// // tag 461
// String getCfiCode();
//
// // tag 231
// double getContractMultiplier();
//
// // tag 15
// String getCurrency();
//
// // tag 779
// LocalDateTime getLastUpdateTime();
//
// // tag 1142
// String getMatchAlgorithm();
//
// // tag 200
// String getMaturityMonthYear();
//
// // tag 1140
// int getMaxTradeVol();
//
// // tag 969
// double getMinPriceIncrement();
//
// // tag 460 - int
// Product getProduct();
//
// // tag 201 - int
// PutOrCall getPutOrCall();
//
// // tag 107
// String getSecurityDesc();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// // tag 48
// String getSecurityID();
//
// // tag 22
// SecurityIDSource getSecurityIDSource();
//
// // tag 1607
// SecurityRejectReason getSecurityRejectReason();
//
// // tag 320
// String getSecurityReqID();
//
// // tag 560
// SecurityRequestResult getSecurityRequestResult();
//
// // tag 323
// SecurityResponseType getSecurityResponseType();
//
// // tag 167
// String getSecurityType();
//
// // tag 120
// String getSettlCurrency();
//
// // tag 731 - int
// SettlPriceType getSettlPriceType();
//
// // tag 202
// double getStrikePrice();
//
// // tag 23
// SubscriptionRequestType getSubscriptionRequestType();
//
// // tag 55
// String getSymbol();
//
// // tag 336
// String getTradingSessionID();
//
// // tag 625
// String getTradingSessionSubID();
//
// // tag 462 - int
// Product getUnderlyingProduct();
//
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinitionRequest.java
// public interface SecurityDefinitionRequest extends Message {
//
// String getCfiCode();
//
// String getMarketID();
//
// String getMarketSegmentID();
//
// String getProduct();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// String getSecurityReqID();
//
// SecurityRequestType getSecurityRequestType();
//
// String getSecurityType();
//
// SubscriptionRequestType getSubscriptionRequestType();
//
// String getSymbol();
//
// String getTradingSessionID();
//
// String getTradingSessionSubID();
//
// void setCfiCode(String cfiCode);
//
// }
|
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinition;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinitionRequest;
|
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.securitydef.datastore;
/**
* Interface for security definition data store
*
* @author Don Mendelson
*
*/
public interface SecurityDefinitionStore extends AutoCloseable {
/**
* Delete a security definition that matches the characteristics of the request
*
* @param securityDefinitionRequest a request
* @return future provides asynchronous result
*/
CompletableFuture<SecurityDefinitionStore> delete(
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinition.java
// public interface SecurityDefinition extends Message {
//
// interface InstrAttrib {
// // tag 871
// InstrAttribType getInstrAttribType();
//
// // tag 872
// String getInstrAttribValue();
// }
//
// interface MarketSegment {
//
// // tag 1301
// String getMarketID();
//
// // tag 1300
// String getMarketSegmentID();
// }
//
// // tag 870
// int getNoInstrAttrib();
//
// InstrAttrib getInstrAttrib(int index);
//
// // tag 1310
// int getNoMarketSegments();
//
// MarketSegment getMarketSegment(int index);
//
// // tag 461
// String getCfiCode();
//
// // tag 231
// double getContractMultiplier();
//
// // tag 15
// String getCurrency();
//
// // tag 779
// LocalDateTime getLastUpdateTime();
//
// // tag 1142
// String getMatchAlgorithm();
//
// // tag 200
// String getMaturityMonthYear();
//
// // tag 1140
// int getMaxTradeVol();
//
// // tag 969
// double getMinPriceIncrement();
//
// // tag 460 - int
// Product getProduct();
//
// // tag 201 - int
// PutOrCall getPutOrCall();
//
// // tag 107
// String getSecurityDesc();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// // tag 48
// String getSecurityID();
//
// // tag 22
// SecurityIDSource getSecurityIDSource();
//
// // tag 1607
// SecurityRejectReason getSecurityRejectReason();
//
// // tag 320
// String getSecurityReqID();
//
// // tag 560
// SecurityRequestResult getSecurityRequestResult();
//
// // tag 323
// SecurityResponseType getSecurityResponseType();
//
// // tag 167
// String getSecurityType();
//
// // tag 120
// String getSettlCurrency();
//
// // tag 731 - int
// SettlPriceType getSettlPriceType();
//
// // tag 202
// double getStrikePrice();
//
// // tag 23
// SubscriptionRequestType getSubscriptionRequestType();
//
// // tag 55
// String getSymbol();
//
// // tag 336
// String getTradingSessionID();
//
// // tag 625
// String getTradingSessionSubID();
//
// // tag 462 - int
// Product getUnderlyingProduct();
//
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinitionRequest.java
// public interface SecurityDefinitionRequest extends Message {
//
// String getCfiCode();
//
// String getMarketID();
//
// String getMarketSegmentID();
//
// String getProduct();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// String getSecurityReqID();
//
// SecurityRequestType getSecurityRequestType();
//
// String getSecurityType();
//
// SubscriptionRequestType getSubscriptionRequestType();
//
// String getSymbol();
//
// String getTradingSessionID();
//
// String getTradingSessionSubID();
//
// void setCfiCode(String cfiCode);
//
// }
// Path: src/main/java/org/fixtrading/timpani/securitydef/datastore/SecurityDefinitionStore.java
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinition;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinitionRequest;
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.securitydef.datastore;
/**
* Interface for security definition data store
*
* @author Don Mendelson
*
*/
public interface SecurityDefinitionStore extends AutoCloseable {
/**
* Delete a security definition that matches the characteristics of the request
*
* @param securityDefinitionRequest a request
* @return future provides asynchronous result
*/
CompletableFuture<SecurityDefinitionStore> delete(
|
SecurityDefinitionRequest securityDefinitionRequest);
|
FIXTradingCommunity/timpani
|
src/main/java/org/fixtrading/timpani/securitydef/datastore/SecurityDefinitionStore.java
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinition.java
// public interface SecurityDefinition extends Message {
//
// interface InstrAttrib {
// // tag 871
// InstrAttribType getInstrAttribType();
//
// // tag 872
// String getInstrAttribValue();
// }
//
// interface MarketSegment {
//
// // tag 1301
// String getMarketID();
//
// // tag 1300
// String getMarketSegmentID();
// }
//
// // tag 870
// int getNoInstrAttrib();
//
// InstrAttrib getInstrAttrib(int index);
//
// // tag 1310
// int getNoMarketSegments();
//
// MarketSegment getMarketSegment(int index);
//
// // tag 461
// String getCfiCode();
//
// // tag 231
// double getContractMultiplier();
//
// // tag 15
// String getCurrency();
//
// // tag 779
// LocalDateTime getLastUpdateTime();
//
// // tag 1142
// String getMatchAlgorithm();
//
// // tag 200
// String getMaturityMonthYear();
//
// // tag 1140
// int getMaxTradeVol();
//
// // tag 969
// double getMinPriceIncrement();
//
// // tag 460 - int
// Product getProduct();
//
// // tag 201 - int
// PutOrCall getPutOrCall();
//
// // tag 107
// String getSecurityDesc();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// // tag 48
// String getSecurityID();
//
// // tag 22
// SecurityIDSource getSecurityIDSource();
//
// // tag 1607
// SecurityRejectReason getSecurityRejectReason();
//
// // tag 320
// String getSecurityReqID();
//
// // tag 560
// SecurityRequestResult getSecurityRequestResult();
//
// // tag 323
// SecurityResponseType getSecurityResponseType();
//
// // tag 167
// String getSecurityType();
//
// // tag 120
// String getSettlCurrency();
//
// // tag 731 - int
// SettlPriceType getSettlPriceType();
//
// // tag 202
// double getStrikePrice();
//
// // tag 23
// SubscriptionRequestType getSubscriptionRequestType();
//
// // tag 55
// String getSymbol();
//
// // tag 336
// String getTradingSessionID();
//
// // tag 625
// String getTradingSessionSubID();
//
// // tag 462 - int
// Product getUnderlyingProduct();
//
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinitionRequest.java
// public interface SecurityDefinitionRequest extends Message {
//
// String getCfiCode();
//
// String getMarketID();
//
// String getMarketSegmentID();
//
// String getProduct();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// String getSecurityReqID();
//
// SecurityRequestType getSecurityRequestType();
//
// String getSecurityType();
//
// SubscriptionRequestType getSubscriptionRequestType();
//
// String getSymbol();
//
// String getTradingSessionID();
//
// String getTradingSessionSubID();
//
// void setCfiCode(String cfiCode);
//
// }
|
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinition;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinitionRequest;
|
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.securitydef.datastore;
/**
* Interface for security definition data store
*
* @author Don Mendelson
*
*/
public interface SecurityDefinitionStore extends AutoCloseable {
/**
* Delete a security definition that matches the characteristics of the request
*
* @param securityDefinitionRequest a request
* @return future provides asynchronous result
*/
CompletableFuture<SecurityDefinitionStore> delete(
SecurityDefinitionRequest securityDefinitionRequest);
/**
* Insert a collection of security definitions into the store
*
* @param securityDefinitions a collection of populated objects
* @return future provides asynchronous result
*/
CompletableFuture<SecurityDefinitionStore> insert(
|
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinition.java
// public interface SecurityDefinition extends Message {
//
// interface InstrAttrib {
// // tag 871
// InstrAttribType getInstrAttribType();
//
// // tag 872
// String getInstrAttribValue();
// }
//
// interface MarketSegment {
//
// // tag 1301
// String getMarketID();
//
// // tag 1300
// String getMarketSegmentID();
// }
//
// // tag 870
// int getNoInstrAttrib();
//
// InstrAttrib getInstrAttrib(int index);
//
// // tag 1310
// int getNoMarketSegments();
//
// MarketSegment getMarketSegment(int index);
//
// // tag 461
// String getCfiCode();
//
// // tag 231
// double getContractMultiplier();
//
// // tag 15
// String getCurrency();
//
// // tag 779
// LocalDateTime getLastUpdateTime();
//
// // tag 1142
// String getMatchAlgorithm();
//
// // tag 200
// String getMaturityMonthYear();
//
// // tag 1140
// int getMaxTradeVol();
//
// // tag 969
// double getMinPriceIncrement();
//
// // tag 460 - int
// Product getProduct();
//
// // tag 201 - int
// PutOrCall getPutOrCall();
//
// // tag 107
// String getSecurityDesc();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// // tag 48
// String getSecurityID();
//
// // tag 22
// SecurityIDSource getSecurityIDSource();
//
// // tag 1607
// SecurityRejectReason getSecurityRejectReason();
//
// // tag 320
// String getSecurityReqID();
//
// // tag 560
// SecurityRequestResult getSecurityRequestResult();
//
// // tag 323
// SecurityResponseType getSecurityResponseType();
//
// // tag 167
// String getSecurityType();
//
// // tag 120
// String getSettlCurrency();
//
// // tag 731 - int
// SettlPriceType getSettlPriceType();
//
// // tag 202
// double getStrikePrice();
//
// // tag 23
// SubscriptionRequestType getSubscriptionRequestType();
//
// // tag 55
// String getSymbol();
//
// // tag 336
// String getTradingSessionID();
//
// // tag 625
// String getTradingSessionSubID();
//
// // tag 462 - int
// Product getUnderlyingProduct();
//
//
// }
//
// Path: src/main/java/org/fixtrading/timpani/securitydef/messages/SecurityDefinitionRequest.java
// public interface SecurityDefinitionRequest extends Message {
//
// String getCfiCode();
//
// String getMarketID();
//
// String getMarketSegmentID();
//
// String getProduct();
//
// // tag 207
// String getSecurityExchange();
//
// // tag 1151
// String getSecurityGroup();
//
// String getSecurityReqID();
//
// SecurityRequestType getSecurityRequestType();
//
// String getSecurityType();
//
// SubscriptionRequestType getSubscriptionRequestType();
//
// String getSymbol();
//
// String getTradingSessionID();
//
// String getTradingSessionSubID();
//
// void setCfiCode(String cfiCode);
//
// }
// Path: src/main/java/org/fixtrading/timpani/securitydef/datastore/SecurityDefinitionStore.java
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinition;
import org.fixtrading.timpani.securitydef.messages.SecurityDefinitionRequest;
/**
* Copyright 2016 FIX Protocol Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package org.fixtrading.timpani.securitydef.datastore;
/**
* Interface for security definition data store
*
* @author Don Mendelson
*
*/
public interface SecurityDefinitionStore extends AutoCloseable {
/**
* Delete a security definition that matches the characteristics of the request
*
* @param securityDefinitionRequest a request
* @return future provides asynchronous result
*/
CompletableFuture<SecurityDefinitionStore> delete(
SecurityDefinitionRequest securityDefinitionRequest);
/**
* Insert a collection of security definitions into the store
*
* @param securityDefinitions a collection of populated objects
* @return future provides asynchronous result
*/
CompletableFuture<SecurityDefinitionStore> insert(
|
Collection<SecurityDefinition> securityDefinitions);
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/ServiceUtils.java
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WebsocketRequest.java
// public abstract class WebsocketRequest {
// public enum AmountType { AMOUNT_BASED_ON_BTC
// , AMOUNT_BASED_ON_USD_BEFORE_FEES
// , AMOUNT_BASED_ON_USD_AFTER_FEES
// }
//
// public static final int TYPE_REQUEST_VERSION = 0;
// public static final int TYPE_CREATE_GUEST_ACCOUNT = 1;
// public static final int TYPE_LOGIN = 2;
// public static final int TYPE_REQUEST_STATUS = 3;
// public static final int TYPE_PING = 4;
// public static final int TYPE_REQUEST_QUOTE = 5;
// public static final int TYPE_SEND_PAYMENT = 6;
//
// abstract public int getRequestType();
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ParameterizedRunnable.java
// public interface ParameterizedRunnable {
// public void run(WebsocketReply reply);
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/RequestAndRunnable.java
// public class RequestAndRunnable {
// private WebsocketRequest request;
// private ParameterizedRunnable runnable;
//
// public RequestAndRunnable(WebsocketRequest request, ParameterizedRunnable runnable) {
// this.request = request;
// this.runnable = runnable;
// }
//
// public WebsocketRequest getRequest() {
// return request;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
|
import java.util.LinkedList;
import java.util.List;
import com.bridgewalkerapp.androidclient.apidata.WebsocketRequest;
import com.bridgewalkerapp.androidclient.data.ParameterizedRunnable;
import com.bridgewalkerapp.androidclient.data.RequestAndRunnable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler.Callback;
import android.os.Messenger;
|
}
public void unbindService() {
if (this.isServiceBound) {
try {
Message msg = Message.obtain(null, BackendService.MSG_UNREGISTER_CLIENT);
msg.replyTo = myMessenger;
serviceMessenger.send(msg);
} catch (RemoteException e) { /* can be ignored */ }
this.context.unbindService(serviceConnection);
isServiceBound = false;
}
}
public void sendCommand(int what) {
Message msg = Message.obtain(null, what);
msg.replyTo = this.myMessenger;
if (this.serviceMessenger != null) {
try {
this.serviceMessenger.send(msg);
} catch (RemoteException e) {
this.commandQueue.add(msg);
}
} else {
this.commandQueue.add(msg);
}
}
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WebsocketRequest.java
// public abstract class WebsocketRequest {
// public enum AmountType { AMOUNT_BASED_ON_BTC
// , AMOUNT_BASED_ON_USD_BEFORE_FEES
// , AMOUNT_BASED_ON_USD_AFTER_FEES
// }
//
// public static final int TYPE_REQUEST_VERSION = 0;
// public static final int TYPE_CREATE_GUEST_ACCOUNT = 1;
// public static final int TYPE_LOGIN = 2;
// public static final int TYPE_REQUEST_STATUS = 3;
// public static final int TYPE_PING = 4;
// public static final int TYPE_REQUEST_QUOTE = 5;
// public static final int TYPE_SEND_PAYMENT = 6;
//
// abstract public int getRequestType();
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ParameterizedRunnable.java
// public interface ParameterizedRunnable {
// public void run(WebsocketReply reply);
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/RequestAndRunnable.java
// public class RequestAndRunnable {
// private WebsocketRequest request;
// private ParameterizedRunnable runnable;
//
// public RequestAndRunnable(WebsocketRequest request, ParameterizedRunnable runnable) {
// this.request = request;
// this.runnable = runnable;
// }
//
// public WebsocketRequest getRequest() {
// return request;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/ServiceUtils.java
import java.util.LinkedList;
import java.util.List;
import com.bridgewalkerapp.androidclient.apidata.WebsocketRequest;
import com.bridgewalkerapp.androidclient.data.ParameterizedRunnable;
import com.bridgewalkerapp.androidclient.data.RequestAndRunnable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler.Callback;
import android.os.Messenger;
}
public void unbindService() {
if (this.isServiceBound) {
try {
Message msg = Message.obtain(null, BackendService.MSG_UNREGISTER_CLIENT);
msg.replyTo = myMessenger;
serviceMessenger.send(msg);
} catch (RemoteException e) { /* can be ignored */ }
this.context.unbindService(serviceConnection);
isServiceBound = false;
}
}
public void sendCommand(int what) {
Message msg = Message.obtain(null, what);
msg.replyTo = this.myMessenger;
if (this.serviceMessenger != null) {
try {
this.serviceMessenger.send(msg);
} catch (RemoteException e) {
this.commandQueue.add(msg);
}
} else {
this.commandQueue.add(msg);
}
}
|
public void sendCommand(WebsocketRequest request, ParameterizedRunnable runnable) {
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/ServiceUtils.java
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WebsocketRequest.java
// public abstract class WebsocketRequest {
// public enum AmountType { AMOUNT_BASED_ON_BTC
// , AMOUNT_BASED_ON_USD_BEFORE_FEES
// , AMOUNT_BASED_ON_USD_AFTER_FEES
// }
//
// public static final int TYPE_REQUEST_VERSION = 0;
// public static final int TYPE_CREATE_GUEST_ACCOUNT = 1;
// public static final int TYPE_LOGIN = 2;
// public static final int TYPE_REQUEST_STATUS = 3;
// public static final int TYPE_PING = 4;
// public static final int TYPE_REQUEST_QUOTE = 5;
// public static final int TYPE_SEND_PAYMENT = 6;
//
// abstract public int getRequestType();
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ParameterizedRunnable.java
// public interface ParameterizedRunnable {
// public void run(WebsocketReply reply);
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/RequestAndRunnable.java
// public class RequestAndRunnable {
// private WebsocketRequest request;
// private ParameterizedRunnable runnable;
//
// public RequestAndRunnable(WebsocketRequest request, ParameterizedRunnable runnable) {
// this.request = request;
// this.runnable = runnable;
// }
//
// public WebsocketRequest getRequest() {
// return request;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
|
import java.util.LinkedList;
import java.util.List;
import com.bridgewalkerapp.androidclient.apidata.WebsocketRequest;
import com.bridgewalkerapp.androidclient.data.ParameterizedRunnable;
import com.bridgewalkerapp.androidclient.data.RequestAndRunnable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler.Callback;
import android.os.Messenger;
|
}
public void unbindService() {
if (this.isServiceBound) {
try {
Message msg = Message.obtain(null, BackendService.MSG_UNREGISTER_CLIENT);
msg.replyTo = myMessenger;
serviceMessenger.send(msg);
} catch (RemoteException e) { /* can be ignored */ }
this.context.unbindService(serviceConnection);
isServiceBound = false;
}
}
public void sendCommand(int what) {
Message msg = Message.obtain(null, what);
msg.replyTo = this.myMessenger;
if (this.serviceMessenger != null) {
try {
this.serviceMessenger.send(msg);
} catch (RemoteException e) {
this.commandQueue.add(msg);
}
} else {
this.commandQueue.add(msg);
}
}
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WebsocketRequest.java
// public abstract class WebsocketRequest {
// public enum AmountType { AMOUNT_BASED_ON_BTC
// , AMOUNT_BASED_ON_USD_BEFORE_FEES
// , AMOUNT_BASED_ON_USD_AFTER_FEES
// }
//
// public static final int TYPE_REQUEST_VERSION = 0;
// public static final int TYPE_CREATE_GUEST_ACCOUNT = 1;
// public static final int TYPE_LOGIN = 2;
// public static final int TYPE_REQUEST_STATUS = 3;
// public static final int TYPE_PING = 4;
// public static final int TYPE_REQUEST_QUOTE = 5;
// public static final int TYPE_SEND_PAYMENT = 6;
//
// abstract public int getRequestType();
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ParameterizedRunnable.java
// public interface ParameterizedRunnable {
// public void run(WebsocketReply reply);
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/RequestAndRunnable.java
// public class RequestAndRunnable {
// private WebsocketRequest request;
// private ParameterizedRunnable runnable;
//
// public RequestAndRunnable(WebsocketRequest request, ParameterizedRunnable runnable) {
// this.request = request;
// this.runnable = runnable;
// }
//
// public WebsocketRequest getRequest() {
// return request;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/ServiceUtils.java
import java.util.LinkedList;
import java.util.List;
import com.bridgewalkerapp.androidclient.apidata.WebsocketRequest;
import com.bridgewalkerapp.androidclient.data.ParameterizedRunnable;
import com.bridgewalkerapp.androidclient.data.RequestAndRunnable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler.Callback;
import android.os.Messenger;
}
public void unbindService() {
if (this.isServiceBound) {
try {
Message msg = Message.obtain(null, BackendService.MSG_UNREGISTER_CLIENT);
msg.replyTo = myMessenger;
serviceMessenger.send(msg);
} catch (RemoteException e) { /* can be ignored */ }
this.context.unbindService(serviceConnection);
isServiceBound = false;
}
}
public void sendCommand(int what) {
Message msg = Message.obtain(null, what);
msg.replyTo = this.myMessenger;
if (this.serviceMessenger != null) {
try {
this.serviceMessenger.send(msg);
} catch (RemoteException e) {
this.commandQueue.add(msg);
}
} else {
this.commandQueue.add(msg);
}
}
|
public void sendCommand(WebsocketRequest request, ParameterizedRunnable runnable) {
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/ServiceUtils.java
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WebsocketRequest.java
// public abstract class WebsocketRequest {
// public enum AmountType { AMOUNT_BASED_ON_BTC
// , AMOUNT_BASED_ON_USD_BEFORE_FEES
// , AMOUNT_BASED_ON_USD_AFTER_FEES
// }
//
// public static final int TYPE_REQUEST_VERSION = 0;
// public static final int TYPE_CREATE_GUEST_ACCOUNT = 1;
// public static final int TYPE_LOGIN = 2;
// public static final int TYPE_REQUEST_STATUS = 3;
// public static final int TYPE_PING = 4;
// public static final int TYPE_REQUEST_QUOTE = 5;
// public static final int TYPE_SEND_PAYMENT = 6;
//
// abstract public int getRequestType();
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ParameterizedRunnable.java
// public interface ParameterizedRunnable {
// public void run(WebsocketReply reply);
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/RequestAndRunnable.java
// public class RequestAndRunnable {
// private WebsocketRequest request;
// private ParameterizedRunnable runnable;
//
// public RequestAndRunnable(WebsocketRequest request, ParameterizedRunnable runnable) {
// this.request = request;
// this.runnable = runnable;
// }
//
// public WebsocketRequest getRequest() {
// return request;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
|
import java.util.LinkedList;
import java.util.List;
import com.bridgewalkerapp.androidclient.apidata.WebsocketRequest;
import com.bridgewalkerapp.androidclient.data.ParameterizedRunnable;
import com.bridgewalkerapp.androidclient.data.RequestAndRunnable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler.Callback;
import android.os.Messenger;
|
if (this.isServiceBound) {
try {
Message msg = Message.obtain(null, BackendService.MSG_UNREGISTER_CLIENT);
msg.replyTo = myMessenger;
serviceMessenger.send(msg);
} catch (RemoteException e) { /* can be ignored */ }
this.context.unbindService(serviceConnection);
isServiceBound = false;
}
}
public void sendCommand(int what) {
Message msg = Message.obtain(null, what);
msg.replyTo = this.myMessenger;
if (this.serviceMessenger != null) {
try {
this.serviceMessenger.send(msg);
} catch (RemoteException e) {
this.commandQueue.add(msg);
}
} else {
this.commandQueue.add(msg);
}
}
public void sendCommand(WebsocketRequest request, ParameterizedRunnable runnable) {
Message msg = Message.obtain(null, BackendService.MSG_SEND_COMMAND);
msg.replyTo = this.myMessenger;
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WebsocketRequest.java
// public abstract class WebsocketRequest {
// public enum AmountType { AMOUNT_BASED_ON_BTC
// , AMOUNT_BASED_ON_USD_BEFORE_FEES
// , AMOUNT_BASED_ON_USD_AFTER_FEES
// }
//
// public static final int TYPE_REQUEST_VERSION = 0;
// public static final int TYPE_CREATE_GUEST_ACCOUNT = 1;
// public static final int TYPE_LOGIN = 2;
// public static final int TYPE_REQUEST_STATUS = 3;
// public static final int TYPE_PING = 4;
// public static final int TYPE_REQUEST_QUOTE = 5;
// public static final int TYPE_SEND_PAYMENT = 6;
//
// abstract public int getRequestType();
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ParameterizedRunnable.java
// public interface ParameterizedRunnable {
// public void run(WebsocketReply reply);
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/RequestAndRunnable.java
// public class RequestAndRunnable {
// private WebsocketRequest request;
// private ParameterizedRunnable runnable;
//
// public RequestAndRunnable(WebsocketRequest request, ParameterizedRunnable runnable) {
// this.request = request;
// this.runnable = runnable;
// }
//
// public WebsocketRequest getRequest() {
// return request;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/ServiceUtils.java
import java.util.LinkedList;
import java.util.List;
import com.bridgewalkerapp.androidclient.apidata.WebsocketRequest;
import com.bridgewalkerapp.androidclient.data.ParameterizedRunnable;
import com.bridgewalkerapp.androidclient.data.RequestAndRunnable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler.Callback;
import android.os.Messenger;
if (this.isServiceBound) {
try {
Message msg = Message.obtain(null, BackendService.MSG_UNREGISTER_CLIENT);
msg.replyTo = myMessenger;
serviceMessenger.send(msg);
} catch (RemoteException e) { /* can be ignored */ }
this.context.unbindService(serviceConnection);
isServiceBound = false;
}
}
public void sendCommand(int what) {
Message msg = Message.obtain(null, what);
msg.replyTo = this.myMessenger;
if (this.serviceMessenger != null) {
try {
this.serviceMessenger.send(msg);
} catch (RemoteException e) {
this.commandQueue.add(msg);
}
} else {
this.commandQueue.add(msg);
}
}
public void sendCommand(WebsocketRequest request, ParameterizedRunnable runnable) {
Message msg = Message.obtain(null, BackendService.MSG_SEND_COMMAND);
msg.replyTo = this.myMessenger;
|
RequestAndRunnable randr = new RequestAndRunnable(request, runnable);
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
|
import java.util.List;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
|
package com.bridgewalkerapp.androidclient.apidata;
@JsonIgnoreProperties(ignoreUnknown=true)
public class WSStatus extends WebsocketReply {
private long usdBalance;
private long btcIn;
private String primaryBTCAddress;
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
import java.util.List;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
package com.bridgewalkerapp.androidclient.apidata;
@JsonIgnoreProperties(ignoreUnknown=true)
public class WSStatus extends WebsocketReply {
private long usdBalance;
private long btcIn;
private String primaryBTCAddress;
|
private List<PendingTransaction> pendingTxs;
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/BalanceFragment.java
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class WSStatus extends WebsocketReply {
// private long usdBalance;
// private long btcIn;
// private String primaryBTCAddress;
// private List<PendingTransaction> pendingTxs;
// private boolean exchangeAvailable;
// private long exchangeRate;
//
// @JsonProperty("usd_balance")
// public long getUsdBalance() {
// return usdBalance;
// }
//
// public void setUsdBalance(long usdBalance) {
// this.usdBalance = usdBalance;
// }
//
// @JsonProperty("btc_in")
// public long getBtcIn() {
// return btcIn;
// }
//
// public void setBtcIn(long btcIn) {
// this.btcIn = btcIn;
// }
//
// @JsonProperty("primary_btc_address")
// public String getPrimaryBTCAddress() {
// return primaryBTCAddress;
// }
//
// public void setPrimaryBTCAddress(String primaryBTCAddress) {
// this.primaryBTCAddress = primaryBTCAddress;
// }
//
// @JsonProperty("pending_txs")
// public List<PendingTransaction> getPendingTxs() {
// return pendingTxs;
// }
//
// public void setPendingTxs(List<PendingTransaction> pendingTxs) {
// this.pendingTxs = pendingTxs;
// }
//
// public boolean isExchangeAvailable() {
// return exchangeAvailable;
// }
//
// @JsonProperty("exchange_available")
// public void setExchangeAvailable(boolean exchangeAvailable) {
// this.exchangeAvailable = exchangeAvailable;
// }
//
// public long getExchangeRate() {
// return exchangeRate;
// }
//
// @JsonProperty("exchange_rate")
// public void setExchangeRate(long exchangeRate) {
// this.exchangeRate = exchangeRate;
// }
//
// @Override
// public int getReplyType() {
// return TYPE_WS_STATUS;
// }
//
// @Override
// public boolean isReplyTo(WebsocketRequest request) {
// return request.getRequestType() == WebsocketRequest.TYPE_REQUEST_STATUS;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ReplyAndRunnable.java
// public class ReplyAndRunnable {
// private WebsocketReply reply;
// private ParameterizedRunnable runnable;
//
// public ReplyAndRunnable(WebsocketReply reply, ParameterizedRunnable runnable) {
// this.reply = reply;
// this.runnable = runnable;
// }
//
// public WebsocketReply getReply() {
// return reply;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
|
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.bridgewalkerapp.androidclient.apidata.WSStatus;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
import com.bridgewalkerapp.androidclient.data.ReplyAndRunnable;
|
package com.bridgewalkerapp.androidclient;
abstract public class BalanceFragment extends SherlockFragment implements BitcoinFragment {
private static final String TAG = "com.bridgewalkerapp";
private static final boolean DEBUG_LOG = false;
public static enum Rounding { ROUND_DOWN, NO_ROUNDING };
protected ProgressBar progressBar = null;
protected LinearLayout contentLinearLayout = null;
protected TextView usdBalanceTextView = null;
protected TextView exchangeRateTextView = null;
protected TextView pendingEventsTextView = null;
protected BitcoinFragmentHost parentActivity = null;
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class WSStatus extends WebsocketReply {
// private long usdBalance;
// private long btcIn;
// private String primaryBTCAddress;
// private List<PendingTransaction> pendingTxs;
// private boolean exchangeAvailable;
// private long exchangeRate;
//
// @JsonProperty("usd_balance")
// public long getUsdBalance() {
// return usdBalance;
// }
//
// public void setUsdBalance(long usdBalance) {
// this.usdBalance = usdBalance;
// }
//
// @JsonProperty("btc_in")
// public long getBtcIn() {
// return btcIn;
// }
//
// public void setBtcIn(long btcIn) {
// this.btcIn = btcIn;
// }
//
// @JsonProperty("primary_btc_address")
// public String getPrimaryBTCAddress() {
// return primaryBTCAddress;
// }
//
// public void setPrimaryBTCAddress(String primaryBTCAddress) {
// this.primaryBTCAddress = primaryBTCAddress;
// }
//
// @JsonProperty("pending_txs")
// public List<PendingTransaction> getPendingTxs() {
// return pendingTxs;
// }
//
// public void setPendingTxs(List<PendingTransaction> pendingTxs) {
// this.pendingTxs = pendingTxs;
// }
//
// public boolean isExchangeAvailable() {
// return exchangeAvailable;
// }
//
// @JsonProperty("exchange_available")
// public void setExchangeAvailable(boolean exchangeAvailable) {
// this.exchangeAvailable = exchangeAvailable;
// }
//
// public long getExchangeRate() {
// return exchangeRate;
// }
//
// @JsonProperty("exchange_rate")
// public void setExchangeRate(long exchangeRate) {
// this.exchangeRate = exchangeRate;
// }
//
// @Override
// public int getReplyType() {
// return TYPE_WS_STATUS;
// }
//
// @Override
// public boolean isReplyTo(WebsocketRequest request) {
// return request.getRequestType() == WebsocketRequest.TYPE_REQUEST_STATUS;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ReplyAndRunnable.java
// public class ReplyAndRunnable {
// private WebsocketReply reply;
// private ParameterizedRunnable runnable;
//
// public ReplyAndRunnable(WebsocketReply reply, ParameterizedRunnable runnable) {
// this.reply = reply;
// this.runnable = runnable;
// }
//
// public WebsocketReply getReply() {
// return reply;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/BalanceFragment.java
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.bridgewalkerapp.androidclient.apidata.WSStatus;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
import com.bridgewalkerapp.androidclient.data.ReplyAndRunnable;
package com.bridgewalkerapp.androidclient;
abstract public class BalanceFragment extends SherlockFragment implements BitcoinFragment {
private static final String TAG = "com.bridgewalkerapp";
private static final boolean DEBUG_LOG = false;
public static enum Rounding { ROUND_DOWN, NO_ROUNDING };
protected ProgressBar progressBar = null;
protected LinearLayout contentLinearLayout = null;
protected TextView usdBalanceTextView = null;
protected TextView exchangeRateTextView = null;
protected TextView pendingEventsTextView = null;
protected BitcoinFragmentHost parentActivity = null;
|
protected WSStatus currentStatus = null;
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/BalanceFragment.java
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class WSStatus extends WebsocketReply {
// private long usdBalance;
// private long btcIn;
// private String primaryBTCAddress;
// private List<PendingTransaction> pendingTxs;
// private boolean exchangeAvailable;
// private long exchangeRate;
//
// @JsonProperty("usd_balance")
// public long getUsdBalance() {
// return usdBalance;
// }
//
// public void setUsdBalance(long usdBalance) {
// this.usdBalance = usdBalance;
// }
//
// @JsonProperty("btc_in")
// public long getBtcIn() {
// return btcIn;
// }
//
// public void setBtcIn(long btcIn) {
// this.btcIn = btcIn;
// }
//
// @JsonProperty("primary_btc_address")
// public String getPrimaryBTCAddress() {
// return primaryBTCAddress;
// }
//
// public void setPrimaryBTCAddress(String primaryBTCAddress) {
// this.primaryBTCAddress = primaryBTCAddress;
// }
//
// @JsonProperty("pending_txs")
// public List<PendingTransaction> getPendingTxs() {
// return pendingTxs;
// }
//
// public void setPendingTxs(List<PendingTransaction> pendingTxs) {
// this.pendingTxs = pendingTxs;
// }
//
// public boolean isExchangeAvailable() {
// return exchangeAvailable;
// }
//
// @JsonProperty("exchange_available")
// public void setExchangeAvailable(boolean exchangeAvailable) {
// this.exchangeAvailable = exchangeAvailable;
// }
//
// public long getExchangeRate() {
// return exchangeRate;
// }
//
// @JsonProperty("exchange_rate")
// public void setExchangeRate(long exchangeRate) {
// this.exchangeRate = exchangeRate;
// }
//
// @Override
// public int getReplyType() {
// return TYPE_WS_STATUS;
// }
//
// @Override
// public boolean isReplyTo(WebsocketRequest request) {
// return request.getRequestType() == WebsocketRequest.TYPE_REQUEST_STATUS;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ReplyAndRunnable.java
// public class ReplyAndRunnable {
// private WebsocketReply reply;
// private ParameterizedRunnable runnable;
//
// public ReplyAndRunnable(WebsocketReply reply, ParameterizedRunnable runnable) {
// this.reply = reply;
// this.runnable = runnable;
// }
//
// public WebsocketReply getReply() {
// return reply;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
|
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.bridgewalkerapp.androidclient.apidata.WSStatus;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
import com.bridgewalkerapp.androidclient.data.ReplyAndRunnable;
|
package com.bridgewalkerapp.androidclient;
abstract public class BalanceFragment extends SherlockFragment implements BitcoinFragment {
private static final String TAG = "com.bridgewalkerapp";
private static final boolean DEBUG_LOG = false;
public static enum Rounding { ROUND_DOWN, NO_ROUNDING };
protected ProgressBar progressBar = null;
protected LinearLayout contentLinearLayout = null;
protected TextView usdBalanceTextView = null;
protected TextView exchangeRateTextView = null;
protected TextView pendingEventsTextView = null;
protected BitcoinFragmentHost parentActivity = null;
protected WSStatus currentStatus = null;
@Override
public void onStart() {
super.onStart();
this.parentActivity = (BitcoinFragmentHost)getActivity();
this.parentActivity.registerFragment(this);
requestStatus(); // always request current status, in case updates
// happened, while the fragment was not displayed
displayStatus(); // if we have status, display that already
}
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case BackendService.MSG_EXECUTE_RUNNABLE:
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class WSStatus extends WebsocketReply {
// private long usdBalance;
// private long btcIn;
// private String primaryBTCAddress;
// private List<PendingTransaction> pendingTxs;
// private boolean exchangeAvailable;
// private long exchangeRate;
//
// @JsonProperty("usd_balance")
// public long getUsdBalance() {
// return usdBalance;
// }
//
// public void setUsdBalance(long usdBalance) {
// this.usdBalance = usdBalance;
// }
//
// @JsonProperty("btc_in")
// public long getBtcIn() {
// return btcIn;
// }
//
// public void setBtcIn(long btcIn) {
// this.btcIn = btcIn;
// }
//
// @JsonProperty("primary_btc_address")
// public String getPrimaryBTCAddress() {
// return primaryBTCAddress;
// }
//
// public void setPrimaryBTCAddress(String primaryBTCAddress) {
// this.primaryBTCAddress = primaryBTCAddress;
// }
//
// @JsonProperty("pending_txs")
// public List<PendingTransaction> getPendingTxs() {
// return pendingTxs;
// }
//
// public void setPendingTxs(List<PendingTransaction> pendingTxs) {
// this.pendingTxs = pendingTxs;
// }
//
// public boolean isExchangeAvailable() {
// return exchangeAvailable;
// }
//
// @JsonProperty("exchange_available")
// public void setExchangeAvailable(boolean exchangeAvailable) {
// this.exchangeAvailable = exchangeAvailable;
// }
//
// public long getExchangeRate() {
// return exchangeRate;
// }
//
// @JsonProperty("exchange_rate")
// public void setExchangeRate(long exchangeRate) {
// this.exchangeRate = exchangeRate;
// }
//
// @Override
// public int getReplyType() {
// return TYPE_WS_STATUS;
// }
//
// @Override
// public boolean isReplyTo(WebsocketRequest request) {
// return request.getRequestType() == WebsocketRequest.TYPE_REQUEST_STATUS;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ReplyAndRunnable.java
// public class ReplyAndRunnable {
// private WebsocketReply reply;
// private ParameterizedRunnable runnable;
//
// public ReplyAndRunnable(WebsocketReply reply, ParameterizedRunnable runnable) {
// this.reply = reply;
// this.runnable = runnable;
// }
//
// public WebsocketReply getReply() {
// return reply;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/BalanceFragment.java
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.bridgewalkerapp.androidclient.apidata.WSStatus;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
import com.bridgewalkerapp.androidclient.data.ReplyAndRunnable;
package com.bridgewalkerapp.androidclient;
abstract public class BalanceFragment extends SherlockFragment implements BitcoinFragment {
private static final String TAG = "com.bridgewalkerapp";
private static final boolean DEBUG_LOG = false;
public static enum Rounding { ROUND_DOWN, NO_ROUNDING };
protected ProgressBar progressBar = null;
protected LinearLayout contentLinearLayout = null;
protected TextView usdBalanceTextView = null;
protected TextView exchangeRateTextView = null;
protected TextView pendingEventsTextView = null;
protected BitcoinFragmentHost parentActivity = null;
protected WSStatus currentStatus = null;
@Override
public void onStart() {
super.onStart();
this.parentActivity = (BitcoinFragmentHost)getActivity();
this.parentActivity.registerFragment(this);
requestStatus(); // always request current status, in case updates
// happened, while the fragment was not displayed
displayStatus(); // if we have status, display that already
}
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case BackendService.MSG_EXECUTE_RUNNABLE:
|
ReplyAndRunnable randr = (ReplyAndRunnable)msg.obj;
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/BalanceFragment.java
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class WSStatus extends WebsocketReply {
// private long usdBalance;
// private long btcIn;
// private String primaryBTCAddress;
// private List<PendingTransaction> pendingTxs;
// private boolean exchangeAvailable;
// private long exchangeRate;
//
// @JsonProperty("usd_balance")
// public long getUsdBalance() {
// return usdBalance;
// }
//
// public void setUsdBalance(long usdBalance) {
// this.usdBalance = usdBalance;
// }
//
// @JsonProperty("btc_in")
// public long getBtcIn() {
// return btcIn;
// }
//
// public void setBtcIn(long btcIn) {
// this.btcIn = btcIn;
// }
//
// @JsonProperty("primary_btc_address")
// public String getPrimaryBTCAddress() {
// return primaryBTCAddress;
// }
//
// public void setPrimaryBTCAddress(String primaryBTCAddress) {
// this.primaryBTCAddress = primaryBTCAddress;
// }
//
// @JsonProperty("pending_txs")
// public List<PendingTransaction> getPendingTxs() {
// return pendingTxs;
// }
//
// public void setPendingTxs(List<PendingTransaction> pendingTxs) {
// this.pendingTxs = pendingTxs;
// }
//
// public boolean isExchangeAvailable() {
// return exchangeAvailable;
// }
//
// @JsonProperty("exchange_available")
// public void setExchangeAvailable(boolean exchangeAvailable) {
// this.exchangeAvailable = exchangeAvailable;
// }
//
// public long getExchangeRate() {
// return exchangeRate;
// }
//
// @JsonProperty("exchange_rate")
// public void setExchangeRate(long exchangeRate) {
// this.exchangeRate = exchangeRate;
// }
//
// @Override
// public int getReplyType() {
// return TYPE_WS_STATUS;
// }
//
// @Override
// public boolean isReplyTo(WebsocketRequest request) {
// return request.getRequestType() == WebsocketRequest.TYPE_REQUEST_STATUS;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ReplyAndRunnable.java
// public class ReplyAndRunnable {
// private WebsocketReply reply;
// private ParameterizedRunnable runnable;
//
// public ReplyAndRunnable(WebsocketReply reply, ParameterizedRunnable runnable) {
// this.reply = reply;
// this.runnable = runnable;
// }
//
// public WebsocketReply getReply() {
// return reply;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
|
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.bridgewalkerapp.androidclient.apidata.WSStatus;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
import com.bridgewalkerapp.androidclient.data.ReplyAndRunnable;
|
}
abstract protected void displayStatusHook();
private String formatBalance(long usdBalance) {
return getString(R.string.balance
, formatUSD(usdBalance, Rounding.ROUND_DOWN));
}
private String formatExchangeRate(long exchangeRate) {
if (exchangeRate != 0) {
return getString(R.string.exchange_rate
, (double)exchangeRate / (double)BackendService.USD_BASE_AMOUNT);
} else {
return "";
}
}
private String formatBTCIn(long btcIn, long exchangeRate) {
if (btcIn == 0) return null;
if (exchangeRate != 0) {
return getString(R.string.waiting_for_exchange_with_usd
, formatBTC(btcIn)
, calcAndFormatUSDEquivalent(btcIn, exchangeRate));
} else {
return getString(R.string.waiting_for_exchange, formatBTC(btcIn));
}
}
|
// Path: src/com/bridgewalkerapp/androidclient/apidata/WSStatus.java
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class WSStatus extends WebsocketReply {
// private long usdBalance;
// private long btcIn;
// private String primaryBTCAddress;
// private List<PendingTransaction> pendingTxs;
// private boolean exchangeAvailable;
// private long exchangeRate;
//
// @JsonProperty("usd_balance")
// public long getUsdBalance() {
// return usdBalance;
// }
//
// public void setUsdBalance(long usdBalance) {
// this.usdBalance = usdBalance;
// }
//
// @JsonProperty("btc_in")
// public long getBtcIn() {
// return btcIn;
// }
//
// public void setBtcIn(long btcIn) {
// this.btcIn = btcIn;
// }
//
// @JsonProperty("primary_btc_address")
// public String getPrimaryBTCAddress() {
// return primaryBTCAddress;
// }
//
// public void setPrimaryBTCAddress(String primaryBTCAddress) {
// this.primaryBTCAddress = primaryBTCAddress;
// }
//
// @JsonProperty("pending_txs")
// public List<PendingTransaction> getPendingTxs() {
// return pendingTxs;
// }
//
// public void setPendingTxs(List<PendingTransaction> pendingTxs) {
// this.pendingTxs = pendingTxs;
// }
//
// public boolean isExchangeAvailable() {
// return exchangeAvailable;
// }
//
// @JsonProperty("exchange_available")
// public void setExchangeAvailable(boolean exchangeAvailable) {
// this.exchangeAvailable = exchangeAvailable;
// }
//
// public long getExchangeRate() {
// return exchangeRate;
// }
//
// @JsonProperty("exchange_rate")
// public void setExchangeRate(long exchangeRate) {
// this.exchangeRate = exchangeRate;
// }
//
// @Override
// public int getReplyType() {
// return TYPE_WS_STATUS;
// }
//
// @Override
// public boolean isReplyTo(WebsocketRequest request) {
// return request.getRequestType() == WebsocketRequest.TYPE_REQUEST_STATUS;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/apidata/subcomponents/PendingTransaction.java
// public class PendingTransaction {
// private long amount;
// private PendingReason reason;
//
// @JsonProperty("amount")
// public long getAmount() {
// return amount;
// }
//
// public void setAmount(long amount) {
// this.amount = amount;
// }
//
// @JsonProperty("reason")
// public PendingReason getReason() {
// return reason;
// }
//
// public void setReason(PendingReason reason) {
// this.reason = reason;
// }
// }
//
// Path: src/com/bridgewalkerapp/androidclient/data/ReplyAndRunnable.java
// public class ReplyAndRunnable {
// private WebsocketReply reply;
// private ParameterizedRunnable runnable;
//
// public ReplyAndRunnable(WebsocketReply reply, ParameterizedRunnable runnable) {
// this.reply = reply;
// this.runnable = runnable;
// }
//
// public WebsocketReply getReply() {
// return reply;
// }
//
// public ParameterizedRunnable getRunnable() {
// return runnable;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/BalanceFragment.java
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.bridgewalkerapp.androidclient.apidata.WSStatus;
import com.bridgewalkerapp.androidclient.apidata.subcomponents.PendingTransaction;
import com.bridgewalkerapp.androidclient.data.ReplyAndRunnable;
}
abstract protected void displayStatusHook();
private String formatBalance(long usdBalance) {
return getString(R.string.balance
, formatUSD(usdBalance, Rounding.ROUND_DOWN));
}
private String formatExchangeRate(long exchangeRate) {
if (exchangeRate != 0) {
return getString(R.string.exchange_rate
, (double)exchangeRate / (double)BackendService.USD_BASE_AMOUNT);
} else {
return "";
}
}
private String formatBTCIn(long btcIn, long exchangeRate) {
if (btcIn == 0) return null;
if (exchangeRate != 0) {
return getString(R.string.waiting_for_exchange_with_usd
, formatBTC(btcIn)
, calcAndFormatUSDEquivalent(btcIn, exchangeRate));
} else {
return getString(R.string.waiting_for_exchange, formatBTC(btcIn));
}
}
|
private List<String> formatPendingTxs(List<PendingTransaction> pendingTxs, long exchangeRate) {
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/tests/BitcoinURITest.java
|
// Path: src/com/bridgewalkerapp/androidclient/BitcoinURI.java
// public class BitcoinURI {
// private static final double BTC_BASE_AMOUNT = Math.pow(10, 8);
//
// private String address;
// private long amount;
// private String currency;
// private String bluetoothAddress;
//
// public BitcoinURI(String address, long amount, String currency) {
// this(address, amount, currency, null);
// }
//
// public BitcoinURI(String address, long amount, String currency, String bluetoothAddress) {
// this.address = address;
// this.amount = amount;
// this.currency = currency;
// this.bluetoothAddress = bluetoothAddress;
// }
//
// public String getAddress() {
// return address;
// }
//
// public long getAmount() {
// return amount;
// }
//
// public String getCurrency() {
// return currency;
// }
//
// public String getBluetoothAddress() {
// return bluetoothAddress;
// }
//
// public static BitcoinURI parse(String uriString) {
// Pattern pattern = Pattern.compile("(bitcoin:(//)?)?([^?]*)(\\?(.*))?");
// Matcher matcher = pattern.matcher(uriString);
//
// if (matcher.matches()) {
// // group 0 is the whole match
// String bitcoinAddress = matcher.group(3);
// String queryPart = matcher.group(5); // might be null
//
// if (queryPart == null)
// return new BitcoinURI(bitcoinAddress, 0, "BTC");
//
// // try to parse amount, currency and bluetooth address
// long amount = 0;
// String currency = "BTC";
// String bluetoothAddress = null;
// Pattern amountSubpattern = Pattern.compile("amount=(.*)");
// Pattern currencySubpattern = Pattern.compile("currency=(.*)");
// Pattern bluetoothSubpattern = Pattern.compile("bt=(.*)");
// String[] parameters = queryPart.split("&");
// for (String parameter : parameters) {
// // amount
// Matcher submatcher = amountSubpattern.matcher(parameter);
// if (submatcher.matches()) {
// String asString = submatcher.group(1);
// try {
// double asDouble = Double.parseDouble(asString);
// amount = Math.round(asDouble * BTC_BASE_AMOUNT);
// } catch (NumberFormatException e) { /* ignore */ }
// }
//
// // currency
// submatcher = currencySubpattern.matcher(parameter);
// if (submatcher.matches()) {
// currency = submatcher.group(1);
// }
//
// // bluetooth address
// submatcher = bluetoothSubpattern.matcher(parameter);
// if (submatcher.matches()) {
// bluetoothAddress = submatcher.group(1);
// }
// }
//
// return new BitcoinURI(bitcoinAddress, amount, currency, bluetoothAddress);
// } else {
// return null;
// }
// }
// }
|
import com.bridgewalkerapp.androidclient.BitcoinURI;
import junit.framework.TestCase;
|
package com.bridgewalkerapp.androidclient.tests;
public class BitcoinURITest extends TestCase {
private void helper(String input, String expectedAddress, long expectedAmount) {
helper(input, expectedAddress, expectedAmount, "BTC");
}
private void helper(String input, String expectedAddress, long expectedAmount, String expectedCurrency) {
|
// Path: src/com/bridgewalkerapp/androidclient/BitcoinURI.java
// public class BitcoinURI {
// private static final double BTC_BASE_AMOUNT = Math.pow(10, 8);
//
// private String address;
// private long amount;
// private String currency;
// private String bluetoothAddress;
//
// public BitcoinURI(String address, long amount, String currency) {
// this(address, amount, currency, null);
// }
//
// public BitcoinURI(String address, long amount, String currency, String bluetoothAddress) {
// this.address = address;
// this.amount = amount;
// this.currency = currency;
// this.bluetoothAddress = bluetoothAddress;
// }
//
// public String getAddress() {
// return address;
// }
//
// public long getAmount() {
// return amount;
// }
//
// public String getCurrency() {
// return currency;
// }
//
// public String getBluetoothAddress() {
// return bluetoothAddress;
// }
//
// public static BitcoinURI parse(String uriString) {
// Pattern pattern = Pattern.compile("(bitcoin:(//)?)?([^?]*)(\\?(.*))?");
// Matcher matcher = pattern.matcher(uriString);
//
// if (matcher.matches()) {
// // group 0 is the whole match
// String bitcoinAddress = matcher.group(3);
// String queryPart = matcher.group(5); // might be null
//
// if (queryPart == null)
// return new BitcoinURI(bitcoinAddress, 0, "BTC");
//
// // try to parse amount, currency and bluetooth address
// long amount = 0;
// String currency = "BTC";
// String bluetoothAddress = null;
// Pattern amountSubpattern = Pattern.compile("amount=(.*)");
// Pattern currencySubpattern = Pattern.compile("currency=(.*)");
// Pattern bluetoothSubpattern = Pattern.compile("bt=(.*)");
// String[] parameters = queryPart.split("&");
// for (String parameter : parameters) {
// // amount
// Matcher submatcher = amountSubpattern.matcher(parameter);
// if (submatcher.matches()) {
// String asString = submatcher.group(1);
// try {
// double asDouble = Double.parseDouble(asString);
// amount = Math.round(asDouble * BTC_BASE_AMOUNT);
// } catch (NumberFormatException e) { /* ignore */ }
// }
//
// // currency
// submatcher = currencySubpattern.matcher(parameter);
// if (submatcher.matches()) {
// currency = submatcher.group(1);
// }
//
// // bluetooth address
// submatcher = bluetoothSubpattern.matcher(parameter);
// if (submatcher.matches()) {
// bluetoothAddress = submatcher.group(1);
// }
// }
//
// return new BitcoinURI(bitcoinAddress, amount, currency, bluetoothAddress);
// } else {
// return null;
// }
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/tests/BitcoinURITest.java
import com.bridgewalkerapp.androidclient.BitcoinURI;
import junit.framework.TestCase;
package com.bridgewalkerapp.androidclient.tests;
public class BitcoinURITest extends TestCase {
private void helper(String input, String expectedAddress, long expectedAmount) {
helper(input, expectedAddress, expectedAmount, "BTC");
}
private void helper(String input, String expectedAddress, long expectedAmount, String expectedCurrency) {
|
BitcoinURI uri = BitcoinURI.parse(input);
|
javgh/Bridgewalker-Android
|
src/com/bridgewalkerapp/androidclient/BluetoothSendTask.java
|
// Path: src/com/bridgewalkerapp/androidclient/data/Maybe.java
// public class Maybe<T> {
// private boolean containsValue;
// private T value;
//
// public Maybe() {
// this.value = null;
// this.containsValue = false;
// }
//
// public Maybe(T value) {
// this.value = value;
// this.containsValue = value != null;
// }
//
// public boolean containsValue() {
// return containsValue;
// }
//
// public T getValue() {
// return value;
// }
// }
|
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import com.bridgewalkerapp.androidclient.data.Maybe;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
|
package com.bridgewalkerapp.androidclient;
public class BluetoothSendTask implements Runnable {
private static final UUID BITCOIN_BLUETOOTH_UUID = UUID.fromString("3357A7BB-762D-464A-8D9A-DCA592D57D5B");
|
// Path: src/com/bridgewalkerapp/androidclient/data/Maybe.java
// public class Maybe<T> {
// private boolean containsValue;
// private T value;
//
// public Maybe() {
// this.value = null;
// this.containsValue = false;
// }
//
// public Maybe(T value) {
// this.value = value;
// this.containsValue = value != null;
// }
//
// public boolean containsValue() {
// return containsValue;
// }
//
// public T getValue() {
// return value;
// }
// }
// Path: src/com/bridgewalkerapp/androidclient/BluetoothSendTask.java
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import com.bridgewalkerapp.androidclient.data.Maybe;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
package com.bridgewalkerapp.androidclient;
public class BluetoothSendTask implements Runnable {
private static final UUID BITCOIN_BLUETOOTH_UUID = UUID.fromString("3357A7BB-762D-464A-8D9A-DCA592D57D5B");
|
private BlockingQueue<Maybe<String>> queue;
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
|
import java.util.List;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
import org.servicelayer.shameful.SessionHolder;
|
package org.servicelayer.access;
public class ItemDetailsCalls {
public static List<ItemDetailsDomain> getItemDetailsList() {
List<ItemDetailsDomain> result
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
import java.util.List;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
import org.servicelayer.shameful.SessionHolder;
package org.servicelayer.access;
public class ItemDetailsCalls {
public static List<ItemDetailsDomain> getItemDetailsList() {
List<ItemDetailsDomain> result
|
= SessionHolder.useSession().selectList("ItemDetails.getPlanetResourceTypeNameTier");
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
|
import java.util.List;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
import org.servicelayer.shameful.SessionHolder;
|
package org.servicelayer.access;
public class ItemDetailsCalls {
public static List<ItemDetailsDomain> getItemDetailsList() {
List<ItemDetailsDomain> result
= SessionHolder.useSession().selectList("ItemDetails.getPlanetResourceTypeNameTier");
return result;
}
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
import java.util.List;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
import org.servicelayer.shameful.SessionHolder;
package org.servicelayer.access;
public class ItemDetailsCalls {
public static List<ItemDetailsDomain> getItemDetailsList() {
List<ItemDetailsDomain> result
= SessionHolder.useSession().selectList("ItemDetails.getPlanetResourceTypeNameTier");
return result;
}
|
public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetSchematicsCaller.java
// public class PlanetSchematicsCaller {
//
//
// public static List<SchematicDomain> getSchematicsList(){
// return SessionHolder.useSession().selectList("Schematics.getSchematics");
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/SchematicDomain.java
// public class SchematicDomain {
// private int outputID;
// private String name;
// // private double volume;
// // private double basePrice;
// private int outputQuantity;
// private int marketGroup;
// private int cycleTime;
// private List<ComponentDomain> recipe;
//
// public List<ComponentDomain> getRecipe() {
// return recipe;
// }
// public void setRecipe(List<ComponentDomain> recipe) {
// this.recipe = recipe;
// }
// public int getCycleTime() {
// return cycleTime;
// }
// public void setCycleTime(int cycleTime) {
// this.cycleTime = cycleTime;
// }
// public int getMarketGroup() {
// return marketGroup;
// }
// public void setMarketGroup(int marketGroup) {
// this.marketGroup = marketGroup;
// }
// public int getOutputQuantity() {
// return outputQuantity;
// }
// public void setOutputQuantity(int outputQuantity) {
// this.outputQuantity = outputQuantity;
// }
// public int getOutputID() {
// return outputID;
// }
// public void setOutputID(int outputID) {
// this.outputID = outputID;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
//
// //SIZE AND VOLUME. Either its own thing or in TypeName, what do?
// //Probably TypePreDomain and separate it out into its own map
// //actually baseCost too. This argues for a comprehensive itemTypeMap and a separate planetNameMap. Maybe.
// //volume, base cost,
//
//
// }
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.PlanetSchematicsCaller;
import org.servicelayer.models.SchematicDomain;
|
package org.servicelayer.service;
public class SchematicDAO {
public static Map<Integer, SchematicDomain> getSchematicsMap(){
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetSchematicsCaller.java
// public class PlanetSchematicsCaller {
//
//
// public static List<SchematicDomain> getSchematicsList(){
// return SessionHolder.useSession().selectList("Schematics.getSchematics");
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/SchematicDomain.java
// public class SchematicDomain {
// private int outputID;
// private String name;
// // private double volume;
// // private double basePrice;
// private int outputQuantity;
// private int marketGroup;
// private int cycleTime;
// private List<ComponentDomain> recipe;
//
// public List<ComponentDomain> getRecipe() {
// return recipe;
// }
// public void setRecipe(List<ComponentDomain> recipe) {
// this.recipe = recipe;
// }
// public int getCycleTime() {
// return cycleTime;
// }
// public void setCycleTime(int cycleTime) {
// this.cycleTime = cycleTime;
// }
// public int getMarketGroup() {
// return marketGroup;
// }
// public void setMarketGroup(int marketGroup) {
// this.marketGroup = marketGroup;
// }
// public int getOutputQuantity() {
// return outputQuantity;
// }
// public void setOutputQuantity(int outputQuantity) {
// this.outputQuantity = outputQuantity;
// }
// public int getOutputID() {
// return outputID;
// }
// public void setOutputID(int outputID) {
// this.outputID = outputID;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
//
// //SIZE AND VOLUME. Either its own thing or in TypeName, what do?
// //Probably TypePreDomain and separate it out into its own map
// //actually baseCost too. This argues for a comprehensive itemTypeMap and a separate planetNameMap. Maybe.
// //volume, base cost,
//
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.PlanetSchematicsCaller;
import org.servicelayer.models.SchematicDomain;
package org.servicelayer.service;
public class SchematicDAO {
public static Map<Integer, SchematicDomain> getSchematicsMap(){
|
List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
|
Kurt-Midas/EveGadgets
|
planetary/src/test/java/com/evegadgets/gadgets/planetary/pricing/MockPriceUtilTest.java
|
// Path: planetary/src/main/java/org/planetary/pricing/MockPriceUtil.java
// public class MockPriceUtil {
//
// private static Properties prop = new Properties();
// private static InputStream input = null;
// private static String configFile = "src/main/resources/config.properties";
//
// static{
// System.out.println(configFile);
// try{
// input = new FileInputStream(configFile);
// prop.load(input);
// }catch(IOException e) { e.printStackTrace();}
// finally {
// if (input != null) {
// try {
// input.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// public static Map<Integer, PriceMap> getPriceMap(List<Integer> typeList, Integer region){
// //region doesn't matter atm but will be useful in the future.
// Map<Integer, PriceMap> priceMap = new HashMap<Integer, PriceMap>();
// for(int typeID: typeList){
// int id = typeID;
// String quantString = prop.getProperty(String.valueOf(typeID) + "q");
// String priceString = prop.getProperty(String.valueOf(typeID) + "b");
// //b for buy, not p for price
// try{
// priceMap.put(id, new PriceMap(id, Integer.valueOf(quantString),
// Double.valueOf(priceString)));
// } catch(Exception e){
// System.out.println("ERROR: MockPriceUtil | String parsing failed at <"
// + quantString + " | " + priceString + "> with message: " + e.getMessage());
// }
// }
// return priceMap;
// }
//
// //this is old stuff. Salvaged this code from a reprocessing calculator, this is leftover.
// public static HashMap<Integer, Double> getPriceMap2(List<Materials> componentList){
// HashMap<Integer, Double> priceMap = new HashMap<Integer, Double>();
// for(Materials materials: componentList){
// Integer id = materials.getTypeID();
// String price = prop.getProperty(String.valueOf(id));
// if(price != null){
// priceMap.put(id, Double.parseDouble(price));
// }
// else{
// System.out.println("Price for typeID not found: " + id);
// // priceMap.put(id, null);
// }
// }
// return priceMap;
// }
//
//
//
//
// }
//
// Path: planetary/src/main/java/org/planetary/pricing/PriceMap.java
// public class PriceMap {
// private int id;
// private int quantity;
// private double price;
//
// public PriceMap(int id, int quantity, double price){
// this.id = id;
// this.quantity = quantity;
// this.price = price;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public int getQuantity() {
// return quantity;
// }
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
// public double getPrice() {
// return price;
// }
// public void setPrice(double price) {
// this.price = price;
// }
//
// }
|
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.planetary.pricing.MockPriceUtil;
import org.planetary.pricing.PriceMap;
|
package com.evegadgets.gadgets.planetary.pricing;
@RunWith(MockitoJUnitRunner.class)
public class MockPriceUtilTest {
@Test
public void testGetPriceMap(){
List<Integer> typeList = new ArrayList<Integer>();
typeList.add(2393);
typeList.add(2396);
|
// Path: planetary/src/main/java/org/planetary/pricing/MockPriceUtil.java
// public class MockPriceUtil {
//
// private static Properties prop = new Properties();
// private static InputStream input = null;
// private static String configFile = "src/main/resources/config.properties";
//
// static{
// System.out.println(configFile);
// try{
// input = new FileInputStream(configFile);
// prop.load(input);
// }catch(IOException e) { e.printStackTrace();}
// finally {
// if (input != null) {
// try {
// input.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// public static Map<Integer, PriceMap> getPriceMap(List<Integer> typeList, Integer region){
// //region doesn't matter atm but will be useful in the future.
// Map<Integer, PriceMap> priceMap = new HashMap<Integer, PriceMap>();
// for(int typeID: typeList){
// int id = typeID;
// String quantString = prop.getProperty(String.valueOf(typeID) + "q");
// String priceString = prop.getProperty(String.valueOf(typeID) + "b");
// //b for buy, not p for price
// try{
// priceMap.put(id, new PriceMap(id, Integer.valueOf(quantString),
// Double.valueOf(priceString)));
// } catch(Exception e){
// System.out.println("ERROR: MockPriceUtil | String parsing failed at <"
// + quantString + " | " + priceString + "> with message: " + e.getMessage());
// }
// }
// return priceMap;
// }
//
// //this is old stuff. Salvaged this code from a reprocessing calculator, this is leftover.
// public static HashMap<Integer, Double> getPriceMap2(List<Materials> componentList){
// HashMap<Integer, Double> priceMap = new HashMap<Integer, Double>();
// for(Materials materials: componentList){
// Integer id = materials.getTypeID();
// String price = prop.getProperty(String.valueOf(id));
// if(price != null){
// priceMap.put(id, Double.parseDouble(price));
// }
// else{
// System.out.println("Price for typeID not found: " + id);
// // priceMap.put(id, null);
// }
// }
// return priceMap;
// }
//
//
//
//
// }
//
// Path: planetary/src/main/java/org/planetary/pricing/PriceMap.java
// public class PriceMap {
// private int id;
// private int quantity;
// private double price;
//
// public PriceMap(int id, int quantity, double price){
// this.id = id;
// this.quantity = quantity;
// this.price = price;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public int getQuantity() {
// return quantity;
// }
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
// public double getPrice() {
// return price;
// }
// public void setPrice(double price) {
// this.price = price;
// }
//
// }
// Path: planetary/src/test/java/com/evegadgets/gadgets/planetary/pricing/MockPriceUtilTest.java
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.planetary.pricing.MockPriceUtil;
import org.planetary.pricing.PriceMap;
package com.evegadgets.gadgets.planetary.pricing;
@RunWith(MockitoJUnitRunner.class)
public class MockPriceUtilTest {
@Test
public void testGetPriceMap(){
List<Integer> typeList = new ArrayList<Integer>();
typeList.add(2393);
typeList.add(2396);
|
Map<Integer, PriceMap> result = MockPriceUtil.getPriceMap(typeList, null);
|
Kurt-Midas/EveGadgets
|
planetary/src/test/java/com/evegadgets/gadgets/planetary/pricing/MockPriceUtilTest.java
|
// Path: planetary/src/main/java/org/planetary/pricing/MockPriceUtil.java
// public class MockPriceUtil {
//
// private static Properties prop = new Properties();
// private static InputStream input = null;
// private static String configFile = "src/main/resources/config.properties";
//
// static{
// System.out.println(configFile);
// try{
// input = new FileInputStream(configFile);
// prop.load(input);
// }catch(IOException e) { e.printStackTrace();}
// finally {
// if (input != null) {
// try {
// input.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// public static Map<Integer, PriceMap> getPriceMap(List<Integer> typeList, Integer region){
// //region doesn't matter atm but will be useful in the future.
// Map<Integer, PriceMap> priceMap = new HashMap<Integer, PriceMap>();
// for(int typeID: typeList){
// int id = typeID;
// String quantString = prop.getProperty(String.valueOf(typeID) + "q");
// String priceString = prop.getProperty(String.valueOf(typeID) + "b");
// //b for buy, not p for price
// try{
// priceMap.put(id, new PriceMap(id, Integer.valueOf(quantString),
// Double.valueOf(priceString)));
// } catch(Exception e){
// System.out.println("ERROR: MockPriceUtil | String parsing failed at <"
// + quantString + " | " + priceString + "> with message: " + e.getMessage());
// }
// }
// return priceMap;
// }
//
// //this is old stuff. Salvaged this code from a reprocessing calculator, this is leftover.
// public static HashMap<Integer, Double> getPriceMap2(List<Materials> componentList){
// HashMap<Integer, Double> priceMap = new HashMap<Integer, Double>();
// for(Materials materials: componentList){
// Integer id = materials.getTypeID();
// String price = prop.getProperty(String.valueOf(id));
// if(price != null){
// priceMap.put(id, Double.parseDouble(price));
// }
// else{
// System.out.println("Price for typeID not found: " + id);
// // priceMap.put(id, null);
// }
// }
// return priceMap;
// }
//
//
//
//
// }
//
// Path: planetary/src/main/java/org/planetary/pricing/PriceMap.java
// public class PriceMap {
// private int id;
// private int quantity;
// private double price;
//
// public PriceMap(int id, int quantity, double price){
// this.id = id;
// this.quantity = quantity;
// this.price = price;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public int getQuantity() {
// return quantity;
// }
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
// public double getPrice() {
// return price;
// }
// public void setPrice(double price) {
// this.price = price;
// }
//
// }
|
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.planetary.pricing.MockPriceUtil;
import org.planetary.pricing.PriceMap;
|
package com.evegadgets.gadgets.planetary.pricing;
@RunWith(MockitoJUnitRunner.class)
public class MockPriceUtilTest {
@Test
public void testGetPriceMap(){
List<Integer> typeList = new ArrayList<Integer>();
typeList.add(2393);
typeList.add(2396);
|
// Path: planetary/src/main/java/org/planetary/pricing/MockPriceUtil.java
// public class MockPriceUtil {
//
// private static Properties prop = new Properties();
// private static InputStream input = null;
// private static String configFile = "src/main/resources/config.properties";
//
// static{
// System.out.println(configFile);
// try{
// input = new FileInputStream(configFile);
// prop.load(input);
// }catch(IOException e) { e.printStackTrace();}
// finally {
// if (input != null) {
// try {
// input.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// public static Map<Integer, PriceMap> getPriceMap(List<Integer> typeList, Integer region){
// //region doesn't matter atm but will be useful in the future.
// Map<Integer, PriceMap> priceMap = new HashMap<Integer, PriceMap>();
// for(int typeID: typeList){
// int id = typeID;
// String quantString = prop.getProperty(String.valueOf(typeID) + "q");
// String priceString = prop.getProperty(String.valueOf(typeID) + "b");
// //b for buy, not p for price
// try{
// priceMap.put(id, new PriceMap(id, Integer.valueOf(quantString),
// Double.valueOf(priceString)));
// } catch(Exception e){
// System.out.println("ERROR: MockPriceUtil | String parsing failed at <"
// + quantString + " | " + priceString + "> with message: " + e.getMessage());
// }
// }
// return priceMap;
// }
//
// //this is old stuff. Salvaged this code from a reprocessing calculator, this is leftover.
// public static HashMap<Integer, Double> getPriceMap2(List<Materials> componentList){
// HashMap<Integer, Double> priceMap = new HashMap<Integer, Double>();
// for(Materials materials: componentList){
// Integer id = materials.getTypeID();
// String price = prop.getProperty(String.valueOf(id));
// if(price != null){
// priceMap.put(id, Double.parseDouble(price));
// }
// else{
// System.out.println("Price for typeID not found: " + id);
// // priceMap.put(id, null);
// }
// }
// return priceMap;
// }
//
//
//
//
// }
//
// Path: planetary/src/main/java/org/planetary/pricing/PriceMap.java
// public class PriceMap {
// private int id;
// private int quantity;
// private double price;
//
// public PriceMap(int id, int quantity, double price){
// this.id = id;
// this.quantity = quantity;
// this.price = price;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public int getQuantity() {
// return quantity;
// }
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
// public double getPrice() {
// return price;
// }
// public void setPrice(double price) {
// this.price = price;
// }
//
// }
// Path: planetary/src/test/java/com/evegadgets/gadgets/planetary/pricing/MockPriceUtilTest.java
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.planetary.pricing.MockPriceUtil;
import org.planetary.pricing.PriceMap;
package com.evegadgets.gadgets.planetary.pricing;
@RunWith(MockitoJUnitRunner.class)
public class MockPriceUtilTest {
@Test
public void testGetPriceMap(){
List<Integer> typeList = new ArrayList<Integer>();
typeList.add(2393);
typeList.add(2396);
|
Map<Integer, PriceMap> result = MockPriceUtil.getPriceMap(typeList, null);
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/ScrapService.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ReprocessCaller.java
// public class ReprocessCaller {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
// // Reprocessor
// // getByTypeIdList
// // getByNameList
// public static List<ReprocessRecipeDomain> getRecipesFromNames(List<String> nameList){
// List<ReprocessRecipeDomain> result
// = session.selectList("Reprocessor.getByNameList", nameList);
// return result;
// }
//
// public static List<ReprocessRecipeDomain> getRecipesFromTypeIDs(List<Integer> idList){
// List<ReprocessRecipeDomain> result
// = session.selectList("Reprocessor.getByNameList", idList);
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ReprocessRecipeDomain.java
// public class ReprocessRecipeDomain {
// // int id =
// private int id;
// private List<IdAndQuantityDomain> materials;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<IdAndQuantityDomain> getMaterials() {
// return materials;
// }
// public void setMaterials(List<IdAndQuantityDomain> materials) {
// this.materials = materials;
// }
//
// }
|
import java.util.List;
import org.servicelayer.access.ReprocessCaller;
import org.servicelayer.models.ReprocessRecipeDomain;
|
package org.servicelayer.service;
public class ScrapService {
public static List<ReprocessRecipeDomain> getRecipeList(List<String> items) {
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ReprocessCaller.java
// public class ReprocessCaller {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
// // Reprocessor
// // getByTypeIdList
// // getByNameList
// public static List<ReprocessRecipeDomain> getRecipesFromNames(List<String> nameList){
// List<ReprocessRecipeDomain> result
// = session.selectList("Reprocessor.getByNameList", nameList);
// return result;
// }
//
// public static List<ReprocessRecipeDomain> getRecipesFromTypeIDs(List<Integer> idList){
// List<ReprocessRecipeDomain> result
// = session.selectList("Reprocessor.getByNameList", idList);
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ReprocessRecipeDomain.java
// public class ReprocessRecipeDomain {
// // int id =
// private int id;
// private List<IdAndQuantityDomain> materials;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<IdAndQuantityDomain> getMaterials() {
// return materials;
// }
// public void setMaterials(List<IdAndQuantityDomain> materials) {
// this.materials = materials;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ScrapService.java
import java.util.List;
import org.servicelayer.access.ReprocessCaller;
import org.servicelayer.models.ReprocessRecipeDomain;
package org.servicelayer.service;
public class ScrapService {
public static List<ReprocessRecipeDomain> getRecipeList(List<String> items) {
|
return ReprocessCaller.getRecipesFromNames(items);
|
Kurt-Midas/EveGadgets
|
priceutils/src/main/java/org/priceutils/custommodels/MarketStatResponse.java
|
// Path: priceutils/src/main/java/org/priceutils/models/MarketStatInfo.java
// public class MarketStatInfo {
// private MarketStatQuery forQuery;
// private int volume;
// private double wavg;
// private double avg;
// private double variance;
// private double stdDev;
// private double median;
// private double fivePercent;
// private double max;
// private double min;
// private boolean highToLow;
// private int generated;
//
// public MarketStatQuery getForQuery() {
// return forQuery;
// }
// public void setForQuery(MarketStatQuery forQuery) {
// this.forQuery = forQuery;
// }
// public int getVolume() {
// return volume;
// }
// public void setVolume(int volume) {
// this.volume = volume;
// }
// public double getWavg() {
// return wavg;
// }
// public void setWavg(double wavg) {
// this.wavg = wavg;
// }
// public double getAvg() {
// return avg;
// }
// public void setAvg(double avg) {
// this.avg = avg;
// }
// public double getVariance() {
// return variance;
// }
// public void setVariance(double variance) {
// this.variance = variance;
// }
// public double getStdDev() {
// return stdDev;
// }
// public void setStdDev(double stdDev) {
// this.stdDev = stdDev;
// }
// public double getMedian() {
// return median;
// }
// public void setMedian(double median) {
// this.median = median;
// }
// public double getFivePercent() {
// return fivePercent;
// }
// public void setFivePercent(double fivePercent) {
// this.fivePercent = fivePercent;
// }
// public double getMax() {
// return max;
// }
// public void setMax(double max) {
// this.max = max;
// }
// public double getMin() {
// return min;
// }
// public void setMin(double min) {
// this.min = min;
// }
// public boolean isHighToLow() {
// return highToLow;
// }
// public void setHighToLow(boolean highToLow) {
// this.highToLow = highToLow;
// }
// public int getGenerated() {
// return generated;
// }
// public void setGenerated(int generated) {
// this.generated = generated;
// }
// }
//
// Path: priceutils/src/main/java/org/priceutils/models/MarketStatQuery.java
// public class MarketStatQuery {
//
// private boolean bid;
// private List<Integer> types;
// private List<Integer> regions;
// private List<Integer> systems;
// private int hours;
// private int minq;
//
// public boolean isBid() {
// return bid;
// }
// public void setBid(boolean bid) {
// this.bid = bid;
// }
// public List<Integer> getTypes() {
// return types;
// }
// public void setTypes(List<Integer> types) {
// this.types = types;
// }
// public List<Integer> getRegions() {
// return regions;
// }
// public void setRegions(List<Integer> regions) {
// this.regions = regions;
// }
// public List<Integer> getSystems() {
// return systems;
// }
// public void setSystems(List<Integer> systems) {
// this.systems = systems;
// }
// public int getHours() {
// return hours;
// }
// public void setHours(int hours) {
// this.hours = hours;
// }
// public int getMinq() {
// return minq;
// }
// public void setMinq(int minq) {
// this.minq = minq;
// }
//
// }
|
import org.priceutils.models.MarketStatInfo;
import org.priceutils.models.MarketStatQuery;
|
package org.priceutils.custommodels;
public class MarketStatResponse {
private MarketStatQuery query;
|
// Path: priceutils/src/main/java/org/priceutils/models/MarketStatInfo.java
// public class MarketStatInfo {
// private MarketStatQuery forQuery;
// private int volume;
// private double wavg;
// private double avg;
// private double variance;
// private double stdDev;
// private double median;
// private double fivePercent;
// private double max;
// private double min;
// private boolean highToLow;
// private int generated;
//
// public MarketStatQuery getForQuery() {
// return forQuery;
// }
// public void setForQuery(MarketStatQuery forQuery) {
// this.forQuery = forQuery;
// }
// public int getVolume() {
// return volume;
// }
// public void setVolume(int volume) {
// this.volume = volume;
// }
// public double getWavg() {
// return wavg;
// }
// public void setWavg(double wavg) {
// this.wavg = wavg;
// }
// public double getAvg() {
// return avg;
// }
// public void setAvg(double avg) {
// this.avg = avg;
// }
// public double getVariance() {
// return variance;
// }
// public void setVariance(double variance) {
// this.variance = variance;
// }
// public double getStdDev() {
// return stdDev;
// }
// public void setStdDev(double stdDev) {
// this.stdDev = stdDev;
// }
// public double getMedian() {
// return median;
// }
// public void setMedian(double median) {
// this.median = median;
// }
// public double getFivePercent() {
// return fivePercent;
// }
// public void setFivePercent(double fivePercent) {
// this.fivePercent = fivePercent;
// }
// public double getMax() {
// return max;
// }
// public void setMax(double max) {
// this.max = max;
// }
// public double getMin() {
// return min;
// }
// public void setMin(double min) {
// this.min = min;
// }
// public boolean isHighToLow() {
// return highToLow;
// }
// public void setHighToLow(boolean highToLow) {
// this.highToLow = highToLow;
// }
// public int getGenerated() {
// return generated;
// }
// public void setGenerated(int generated) {
// this.generated = generated;
// }
// }
//
// Path: priceutils/src/main/java/org/priceutils/models/MarketStatQuery.java
// public class MarketStatQuery {
//
// private boolean bid;
// private List<Integer> types;
// private List<Integer> regions;
// private List<Integer> systems;
// private int hours;
// private int minq;
//
// public boolean isBid() {
// return bid;
// }
// public void setBid(boolean bid) {
// this.bid = bid;
// }
// public List<Integer> getTypes() {
// return types;
// }
// public void setTypes(List<Integer> types) {
// this.types = types;
// }
// public List<Integer> getRegions() {
// return regions;
// }
// public void setRegions(List<Integer> regions) {
// this.regions = regions;
// }
// public List<Integer> getSystems() {
// return systems;
// }
// public void setSystems(List<Integer> systems) {
// this.systems = systems;
// }
// public int getHours() {
// return hours;
// }
// public void setHours(int hours) {
// this.hours = hours;
// }
// public int getMinq() {
// return minq;
// }
// public void setMinq(int minq) {
// this.minq = minq;
// }
//
// }
// Path: priceutils/src/main/java/org/priceutils/custommodels/MarketStatResponse.java
import org.priceutils.models.MarketStatInfo;
import org.priceutils.models.MarketStatQuery;
package org.priceutils.custommodels;
public class MarketStatResponse {
private MarketStatQuery query;
|
private MarketStatInfo buy;
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/PlanetSchematicsCaller.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/SchematicDomain.java
// public class SchematicDomain {
// private int outputID;
// private String name;
// // private double volume;
// // private double basePrice;
// private int outputQuantity;
// private int marketGroup;
// private int cycleTime;
// private List<ComponentDomain> recipe;
//
// public List<ComponentDomain> getRecipe() {
// return recipe;
// }
// public void setRecipe(List<ComponentDomain> recipe) {
// this.recipe = recipe;
// }
// public int getCycleTime() {
// return cycleTime;
// }
// public void setCycleTime(int cycleTime) {
// this.cycleTime = cycleTime;
// }
// public int getMarketGroup() {
// return marketGroup;
// }
// public void setMarketGroup(int marketGroup) {
// this.marketGroup = marketGroup;
// }
// public int getOutputQuantity() {
// return outputQuantity;
// }
// public void setOutputQuantity(int outputQuantity) {
// this.outputQuantity = outputQuantity;
// }
// public int getOutputID() {
// return outputID;
// }
// public void setOutputID(int outputID) {
// this.outputID = outputID;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
//
// //SIZE AND VOLUME. Either its own thing or in TypeName, what do?
// //Probably TypePreDomain and separate it out into its own map
// //actually baseCost too. This argues for a comprehensive itemTypeMap and a separate planetNameMap. Maybe.
// //volume, base cost,
//
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
|
import java.util.List;
import org.servicelayer.models.SchematicDomain;
import org.servicelayer.shameful.SessionHolder;
|
package org.servicelayer.access;
public class PlanetSchematicsCaller {
public static List<SchematicDomain> getSchematicsList(){
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/SchematicDomain.java
// public class SchematicDomain {
// private int outputID;
// private String name;
// // private double volume;
// // private double basePrice;
// private int outputQuantity;
// private int marketGroup;
// private int cycleTime;
// private List<ComponentDomain> recipe;
//
// public List<ComponentDomain> getRecipe() {
// return recipe;
// }
// public void setRecipe(List<ComponentDomain> recipe) {
// this.recipe = recipe;
// }
// public int getCycleTime() {
// return cycleTime;
// }
// public void setCycleTime(int cycleTime) {
// this.cycleTime = cycleTime;
// }
// public int getMarketGroup() {
// return marketGroup;
// }
// public void setMarketGroup(int marketGroup) {
// this.marketGroup = marketGroup;
// }
// public int getOutputQuantity() {
// return outputQuantity;
// }
// public void setOutputQuantity(int outputQuantity) {
// this.outputQuantity = outputQuantity;
// }
// public int getOutputID() {
// return outputID;
// }
// public void setOutputID(int outputID) {
// this.outputID = outputID;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
//
//
// //SIZE AND VOLUME. Either its own thing or in TypeName, what do?
// //Probably TypePreDomain and separate it out into its own map
// //actually baseCost too. This argues for a comprehensive itemTypeMap and a separate planetNameMap. Maybe.
// //volume, base cost,
//
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetSchematicsCaller.java
import java.util.List;
import org.servicelayer.models.SchematicDomain;
import org.servicelayer.shameful.SessionHolder;
package org.servicelayer.access;
public class PlanetSchematicsCaller {
public static List<SchematicDomain> getSchematicsList(){
|
return SessionHolder.useSession().selectList("Schematics.getSchematics");
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
|
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
|
package org.servicelayer.shameful;
public class SessionHolder {
private static SqlSession session = null;
static{
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
package org.servicelayer.shameful;
public class SessionHolder {
private static SqlSession session = null;
static{
|
session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/ReprocessCaller.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ReprocessRecipeDomain.java
// public class ReprocessRecipeDomain {
// // int id =
// private int id;
// private List<IdAndQuantityDomain> materials;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<IdAndQuantityDomain> getMaterials() {
// return materials;
// }
// public void setMaterials(List<IdAndQuantityDomain> materials) {
// this.materials = materials;
// }
//
// }
|
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.ReprocessRecipeDomain;
|
package org.servicelayer.access;
public class ReprocessCaller {
private static SqlSession session = null;
static{
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ReprocessRecipeDomain.java
// public class ReprocessRecipeDomain {
// // int id =
// private int id;
// private List<IdAndQuantityDomain> materials;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<IdAndQuantityDomain> getMaterials() {
// return materials;
// }
// public void setMaterials(List<IdAndQuantityDomain> materials) {
// this.materials = materials;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ReprocessCaller.java
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.ReprocessRecipeDomain;
package org.servicelayer.access;
public class ReprocessCaller {
private static SqlSession session = null;
static{
|
session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/ReprocessCaller.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ReprocessRecipeDomain.java
// public class ReprocessRecipeDomain {
// // int id =
// private int id;
// private List<IdAndQuantityDomain> materials;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<IdAndQuantityDomain> getMaterials() {
// return materials;
// }
// public void setMaterials(List<IdAndQuantityDomain> materials) {
// this.materials = materials;
// }
//
// }
|
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.ReprocessRecipeDomain;
|
package org.servicelayer.access;
public class ReprocessCaller {
private static SqlSession session = null;
static{
session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
}
// Reprocessor
// getByTypeIdList
// getByNameList
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ReprocessRecipeDomain.java
// public class ReprocessRecipeDomain {
// // int id =
// private int id;
// private List<IdAndQuantityDomain> materials;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<IdAndQuantityDomain> getMaterials() {
// return materials;
// }
// public void setMaterials(List<IdAndQuantityDomain> materials) {
// this.materials = materials;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ReprocessCaller.java
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.ReprocessRecipeDomain;
package org.servicelayer.access;
public class ReprocessCaller {
private static SqlSession session = null;
static{
session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
}
// Reprocessor
// getByTypeIdList
// getByNameList
|
public static List<ReprocessRecipeDomain> getRecipesFromNames(List<String> nameList){
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/persist/SavePlanetService.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PersistPlanetDomain.java
// public class PersistPlanetDomain {
// private Integer hashKey;
// private String setup;
// private String lastRefreshDate; //no idea what to do with this
// private Integer version;
//
// public Integer calculateHashKey(){
// if(setup == null){
// return null;
// }
// hashKey = setup.hashCode();
// return getHashKey();
// }
// public Integer getHashKey() {
// return hashKey;
// }
// public void setHashKey(Integer hashKey) {
// this.hashKey = hashKey;
// }
// public String getSetup() {
// return setup;
// }
// public void setSetup(String setup) {
// this.setup = setup;
// }
// public String getLastRefreshDate() {
// return lastRefreshDate;
// }
// public void setLastRefreshDate(String lastRefreshDate) {
// this.lastRefreshDate = lastRefreshDate;
// }
// public Integer getVersion() {
// return version;
// }
// public void setVersion(Integer version) {
// this.version = version;
// }
// }
|
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.PersistPlanetDomain;
import org.springframework.ui.ModelMap;
|
package org.planetary.persist;
public class SavePlanetService {
private static SqlSession session = null;
static{
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PersistPlanetDomain.java
// public class PersistPlanetDomain {
// private Integer hashKey;
// private String setup;
// private String lastRefreshDate; //no idea what to do with this
// private Integer version;
//
// public Integer calculateHashKey(){
// if(setup == null){
// return null;
// }
// hashKey = setup.hashCode();
// return getHashKey();
// }
// public Integer getHashKey() {
// return hashKey;
// }
// public void setHashKey(Integer hashKey) {
// this.hashKey = hashKey;
// }
// public String getSetup() {
// return setup;
// }
// public void setSetup(String setup) {
// this.setup = setup;
// }
// public String getLastRefreshDate() {
// return lastRefreshDate;
// }
// public void setLastRefreshDate(String lastRefreshDate) {
// this.lastRefreshDate = lastRefreshDate;
// }
// public Integer getVersion() {
// return version;
// }
// public void setVersion(Integer version) {
// this.version = version;
// }
// }
// Path: planetary/src/main/java/org/planetary/persist/SavePlanetService.java
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.PersistPlanetDomain;
import org.springframework.ui.ModelMap;
package org.planetary.persist;
public class SavePlanetService {
private static SqlSession session = null;
static{
|
session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/persist/SavePlanetService.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PersistPlanetDomain.java
// public class PersistPlanetDomain {
// private Integer hashKey;
// private String setup;
// private String lastRefreshDate; //no idea what to do with this
// private Integer version;
//
// public Integer calculateHashKey(){
// if(setup == null){
// return null;
// }
// hashKey = setup.hashCode();
// return getHashKey();
// }
// public Integer getHashKey() {
// return hashKey;
// }
// public void setHashKey(Integer hashKey) {
// this.hashKey = hashKey;
// }
// public String getSetup() {
// return setup;
// }
// public void setSetup(String setup) {
// this.setup = setup;
// }
// public String getLastRefreshDate() {
// return lastRefreshDate;
// }
// public void setLastRefreshDate(String lastRefreshDate) {
// this.lastRefreshDate = lastRefreshDate;
// }
// public Integer getVersion() {
// return version;
// }
// public void setVersion(Integer version) {
// this.version = version;
// }
// }
|
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.PersistPlanetDomain;
import org.springframework.ui.ModelMap;
|
package org.planetary.persist;
public class SavePlanetService {
private static SqlSession session = null;
static{
session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
}
public enum ResponseCodes{
//no, I don't know why I'm doing this. Doesn't matter had success
SUCCESS(0, "Success"),
FAILURE(1, "Unqualified Failure"),
EXISTS(2, "Setup Hash Exists"),
COLLISION(3, "Hash Collision, please kill the developer");
private int code;
private String message;
private ResponseCodes(int code, String message){
this.code = code;
this.message = message;
}
public int getCode(){
return code;
}
public String getMessage(){
return message;
}
}
|
// Path: ServiceLayer/src/main/java/org/servicelayer/factory/MyBatisConnectionFactory.java
// public class MyBatisConnectionFactory {
//
// private static SqlSessionFactory sessionFactory;
//
// static{
// try{
// String resource = "MyBatisConfig.xml";
// Reader reader = Resources.getResourceAsReader(resource);
// if(sessionFactory == null){
// sessionFactory = new SqlSessionFactoryBuilder().build(reader);
// }
// }catch(Exception e){e.printStackTrace();}
// }
//
// public static SqlSessionFactory getSqlSessionFactory(){
// return sessionFactory;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PersistPlanetDomain.java
// public class PersistPlanetDomain {
// private Integer hashKey;
// private String setup;
// private String lastRefreshDate; //no idea what to do with this
// private Integer version;
//
// public Integer calculateHashKey(){
// if(setup == null){
// return null;
// }
// hashKey = setup.hashCode();
// return getHashKey();
// }
// public Integer getHashKey() {
// return hashKey;
// }
// public void setHashKey(Integer hashKey) {
// this.hashKey = hashKey;
// }
// public String getSetup() {
// return setup;
// }
// public void setSetup(String setup) {
// this.setup = setup;
// }
// public String getLastRefreshDate() {
// return lastRefreshDate;
// }
// public void setLastRefreshDate(String lastRefreshDate) {
// this.lastRefreshDate = lastRefreshDate;
// }
// public Integer getVersion() {
// return version;
// }
// public void setVersion(Integer version) {
// this.version = version;
// }
// }
// Path: planetary/src/main/java/org/planetary/persist/SavePlanetService.java
import org.apache.ibatis.session.SqlSession;
import org.servicelayer.factory.MyBatisConnectionFactory;
import org.servicelayer.models.PersistPlanetDomain;
import org.springframework.ui.ModelMap;
package org.planetary.persist;
public class SavePlanetService {
private static SqlSession session = null;
static{
session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
}
public enum ResponseCodes{
//no, I don't know why I'm doing this. Doesn't matter had success
SUCCESS(0, "Success"),
FAILURE(1, "Unqualified Failure"),
EXISTS(2, "Setup Hash Exists"),
COLLISION(3, "Hash Collision, please kill the developer");
private int code;
private String message;
private ResponseCodes(int code, String message){
this.code = code;
this.message = message;
}
public int getCode(){
return code;
}
public String getMessage(){
return message;
}
}
|
public static ModelMap savePlanetSetup(PersistPlanetDomain planetSetup) {
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
// public class PlanetsCaller {
//
// public static List<PlanetDomain> getPlanets() {
// List<PlanetDomain> result = SessionHolder.useSession().selectList("Planets.getPlanets");
// return result;
// }
//
// public static List<ResourceDomain> getResources() {
// List<ResourceDomain> result = SessionHolder.useSession().selectList("Planets.getResources");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.PlanetsCaller;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
|
package org.servicelayer.service;
public class PlanetDAO {
public static Map<Integer,PlanetDomain> getPlanets(){
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
// public class PlanetsCaller {
//
// public static List<PlanetDomain> getPlanets() {
// List<PlanetDomain> result = SessionHolder.useSession().selectList("Planets.getPlanets");
// return result;
// }
//
// public static List<ResourceDomain> getResources() {
// List<ResourceDomain> result = SessionHolder.useSession().selectList("Planets.getResources");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.PlanetsCaller;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
package org.servicelayer.service;
public class PlanetDAO {
public static Map<Integer,PlanetDomain> getPlanets(){
|
List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
// public class PlanetsCaller {
//
// public static List<PlanetDomain> getPlanets() {
// List<PlanetDomain> result = SessionHolder.useSession().selectList("Planets.getPlanets");
// return result;
// }
//
// public static List<ResourceDomain> getResources() {
// List<ResourceDomain> result = SessionHolder.useSession().selectList("Planets.getResources");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.PlanetsCaller;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
|
package org.servicelayer.service;
public class PlanetDAO {
public static Map<Integer,PlanetDomain> getPlanets(){
List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
for(PlanetDomain p: planetList){
planetMap.put(p.getId(), p);
}
return planetMap;
}
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
// public class PlanetsCaller {
//
// public static List<PlanetDomain> getPlanets() {
// List<PlanetDomain> result = SessionHolder.useSession().selectList("Planets.getPlanets");
// return result;
// }
//
// public static List<ResourceDomain> getResources() {
// List<ResourceDomain> result = SessionHolder.useSession().selectList("Planets.getResources");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.PlanetsCaller;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
package org.servicelayer.service;
public class PlanetDAO {
public static Map<Integer,PlanetDomain> getPlanets(){
List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
for(PlanetDomain p: planetList){
planetMap.put(p.getId(), p);
}
return planetMap;
}
|
public static Map<Integer, ResourceDomain> getResources(){
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
|
import java.util.List;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
import org.servicelayer.shameful.SessionHolder;
|
package org.servicelayer.access;
public class PlanetsCaller {
public static List<PlanetDomain> getPlanets() {
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
import java.util.List;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
import org.servicelayer.shameful.SessionHolder;
package org.servicelayer.access;
public class PlanetsCaller {
public static List<PlanetDomain> getPlanets() {
|
List<PlanetDomain> result = SessionHolder.useSession().selectList("Planets.getPlanets");
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
|
import java.util.List;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
import org.servicelayer.shameful.SessionHolder;
|
package org.servicelayer.access;
public class PlanetsCaller {
public static List<PlanetDomain> getPlanets() {
List<PlanetDomain> result = SessionHolder.useSession().selectList("Planets.getPlanets");
return result;
}
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PlanetDomain.java
// public class PlanetDomain {
// private int id;
// private List<Integer> resourceIDs;
// public List<Integer> getResourceIDs() {
// return resourceIDs;
// }
// public void setResourceIDs(List<Integer> resourceIDs) {
// this.resourceIDs = resourceIDs;
// }
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ResourceDomain.java
// public class ResourceDomain {
//
// private int id;
// private List<Integer> planetIDs;
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
// public List<Integer> getPlanetIDs() {
// return planetIDs;
// }
// public void setPlanetIDs(List<Integer> planetIDs) {
// this.planetIDs = planetIDs;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/PlanetsCaller.java
import java.util.List;
import org.servicelayer.models.PlanetDomain;
import org.servicelayer.models.ResourceDomain;
import org.servicelayer.shameful.SessionHolder;
package org.servicelayer.access;
public class PlanetsCaller {
public static List<PlanetDomain> getPlanets() {
List<PlanetDomain> result = SessionHolder.useSession().selectList("Planets.getPlanets");
return result;
}
|
public static List<ResourceDomain> getResources() {
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/pricing/MockPriceUtil.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/Materials.java
// public class Materials {
//
// private int typeID;
// private int quantity;
// private String materialName;
//
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getQuantity() {
// return quantity;
// }
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
// public String getMaterialName() {
// return materialName;
// }
// public void setMaterialName(String materialName) {
// this.materialName = materialName;
// }
// public Materials(){
//
// }
// public Materials(int typeID, String materialName, int quantity){
// this.typeID = typeID;
// this.materialName = materialName;
// this.quantity=quantity;
// }
//
// }
|
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.servicelayer.models.Materials;
|
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public static Map<Integer, PriceMap> getPriceMap(List<Integer> typeList, Integer region){
//region doesn't matter atm but will be useful in the future.
Map<Integer, PriceMap> priceMap = new HashMap<Integer, PriceMap>();
for(int typeID: typeList){
int id = typeID;
String quantString = prop.getProperty(String.valueOf(typeID) + "q");
String priceString = prop.getProperty(String.valueOf(typeID) + "b");
//b for buy, not p for price
try{
priceMap.put(id, new PriceMap(id, Integer.valueOf(quantString),
Double.valueOf(priceString)));
} catch(Exception e){
System.out.println("ERROR: MockPriceUtil | String parsing failed at <"
+ quantString + " | " + priceString + "> with message: " + e.getMessage());
}
}
return priceMap;
}
//this is old stuff. Salvaged this code from a reprocessing calculator, this is leftover.
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/Materials.java
// public class Materials {
//
// private int typeID;
// private int quantity;
// private String materialName;
//
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getQuantity() {
// return quantity;
// }
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
// public String getMaterialName() {
// return materialName;
// }
// public void setMaterialName(String materialName) {
// this.materialName = materialName;
// }
// public Materials(){
//
// }
// public Materials(int typeID, String materialName, int quantity){
// this.typeID = typeID;
// this.materialName = materialName;
// this.quantity=quantity;
// }
//
// }
// Path: planetary/src/main/java/org/planetary/pricing/MockPriceUtil.java
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.servicelayer.models.Materials;
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public static Map<Integer, PriceMap> getPriceMap(List<Integer> typeList, Integer region){
//region doesn't matter atm but will be useful in the future.
Map<Integer, PriceMap> priceMap = new HashMap<Integer, PriceMap>();
for(int typeID: typeList){
int id = typeID;
String quantString = prop.getProperty(String.valueOf(typeID) + "q");
String priceString = prop.getProperty(String.valueOf(typeID) + "b");
//b for buy, not p for price
try{
priceMap.put(id, new PriceMap(id, Integer.valueOf(quantString),
Double.valueOf(priceString)));
} catch(Exception e){
System.out.println("ERROR: MockPriceUtil | String parsing failed at <"
+ quantString + " | " + priceString + "> with message: " + e.getMessage());
}
}
return priceMap;
}
//this is old stuff. Salvaged this code from a reprocessing calculator, this is leftover.
|
public static HashMap<Integer, Double> getPriceMap2(List<Materials> componentList){
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/NameMapCaller.java
// public class NameMapCaller {
//
// public static List<NameMapDomain> getNameMap() {
// List<NameMapDomain> result
// = SessionHolder.useSession().selectList("NameMap.getPlanetResourceNameMap");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/NameMapDomain.java
// public class NameMapDomain {
//
// private String name;
// private Integer id;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.NameMapCaller;
import org.servicelayer.models.NameMapDomain;
|
package org.servicelayer.service;
public class NameMapDAO {
public static Map<String, Integer> getNames(){
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/NameMapCaller.java
// public class NameMapCaller {
//
// public static List<NameMapDomain> getNameMap() {
// List<NameMapDomain> result
// = SessionHolder.useSession().selectList("NameMap.getPlanetResourceNameMap");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/NameMapDomain.java
// public class NameMapDomain {
//
// private String name;
// private Integer id;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.NameMapCaller;
import org.servicelayer.models.NameMapDomain;
package org.servicelayer.service;
public class NameMapDAO {
public static Map<String, Integer> getNames(){
|
List<NameMapDomain> names = NameMapCaller.getNameMap();
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/NameMapCaller.java
// public class NameMapCaller {
//
// public static List<NameMapDomain> getNameMap() {
// List<NameMapDomain> result
// = SessionHolder.useSession().selectList("NameMap.getPlanetResourceNameMap");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/NameMapDomain.java
// public class NameMapDomain {
//
// private String name;
// private Integer id;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.NameMapCaller;
import org.servicelayer.models.NameMapDomain;
|
package org.servicelayer.service;
public class NameMapDAO {
public static Map<String, Integer> getNames(){
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/NameMapCaller.java
// public class NameMapCaller {
//
// public static List<NameMapDomain> getNameMap() {
// List<NameMapDomain> result
// = SessionHolder.useSession().selectList("NameMap.getPlanetResourceNameMap");
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/NameMapDomain.java
// public class NameMapDomain {
//
// private String name;
// private Integer id;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.NameMapCaller;
import org.servicelayer.models.NameMapDomain;
package org.servicelayer.service;
public class NameMapDAO {
public static Map<String, Integer> getNames(){
|
List<NameMapDomain> names = NameMapCaller.getNameMap();
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
// public class ItemDetailsCalls {
//
// public static List<ItemDetailsDomain> getItemDetailsList() {
// List<ItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getPlanetResourceTypeNameTier");
// return result;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getImportantItemDetails", itemIdList);
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.ItemDetailsCalls;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
|
package org.servicelayer.service;
public class ItemDetailsDAO {
public static Map<Integer, ItemDetailsDomain> getItemDetails(){
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
// public class ItemDetailsCalls {
//
// public static List<ItemDetailsDomain> getItemDetailsList() {
// List<ItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getPlanetResourceTypeNameTier");
// return result;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getImportantItemDetails", itemIdList);
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.ItemDetailsCalls;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
package org.servicelayer.service;
public class ItemDetailsDAO {
public static Map<Integer, ItemDetailsDomain> getItemDetails(){
|
List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
// public class ItemDetailsCalls {
//
// public static List<ItemDetailsDomain> getItemDetailsList() {
// List<ItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getPlanetResourceTypeNameTier");
// return result;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getImportantItemDetails", itemIdList);
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
|
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.ItemDetailsCalls;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
|
package org.servicelayer.service;
public class ItemDetailsDAO {
public static Map<Integer, ItemDetailsDomain> getItemDetails(){
List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
//session.selectList("ItemDetails.getItemDetailsList");
Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
for(ItemDetailsDomain d : itemDetailsList){
resultMap.put(d.getTypeID(), d);
}
return resultMap;
}
|
// Path: ServiceLayer/src/main/java/org/servicelayer/access/ItemDetailsCalls.java
// public class ItemDetailsCalls {
//
// public static List<ItemDetailsDomain> getItemDetailsList() {
// List<ItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getPlanetResourceTypeNameTier");
// return result;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> result
// = SessionHolder.useSession().selectList("ItemDetails.getImportantItemDetails", itemIdList);
// return result;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ImportantItemDetailsDomain.java
// public class ImportantItemDetailsDomain {
//
// private int typeId;
// private String name;
// private Double volume;
// private int groupId;
// private int categoryId;
// private int marketGroupID;
// public int getTypeId() {
// return typeId;
// }
// public void setTypeId(int typeId) {
// this.typeId = typeId;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public Double getVolume() {
// return volume;
// }
// public void setVolume(Double volume) {
// this.volume = volume;
// }
// public int getGroupId() {
// return groupId;
// }
// public void setGroupId(int groupId) {
// this.groupId = groupId;
// }
// public int getCategoryId() {
// return categoryId;
// }
// public void setCategoryId(int categoryId) {
// this.categoryId = categoryId;
// }
// public int getMarketGroupID() {
// return marketGroupID;
// }
// public void setMarketGroupID(int marketGroupID) {
// this.marketGroupID = marketGroupID;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/models/ItemDetailsDomain.java
// public class ItemDetailsDomain {
// private String name;
// private int tier;
// private int typeID;
//
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public int getTypeID() {
// return typeID;
// }
// public void setTypeID(int typeID) {
// this.typeID = typeID;
// }
// public int getTier() {
// return tier;
// }
// public void setTier(int tier) {
// this.tier = tier-1333;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.servicelayer.access.ItemDetailsCalls;
import org.servicelayer.models.ImportantItemDetailsDomain;
import org.servicelayer.models.ItemDetailsDomain;
package org.servicelayer.service;
public class ItemDetailsDAO {
public static Map<Integer, ItemDetailsDomain> getItemDetails(){
List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
//session.selectList("ItemDetails.getItemDetailsList");
Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
for(ItemDetailsDomain d : itemDetailsList){
resultMap.put(d.getTypeID(), d);
}
return resultMap;
}
|
public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
|
Kurt-Midas/EveGadgets
|
ServiceLayer/src/main/java/org/servicelayer/access/NameMapCaller.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/NameMapDomain.java
// public class NameMapDomain {
//
// private String name;
// private Integer id;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
|
import java.util.List;
import org.servicelayer.models.NameMapDomain;
import org.servicelayer.shameful.SessionHolder;
|
package org.servicelayer.access;
public class NameMapCaller {
public static List<NameMapDomain> getNameMap() {
List<NameMapDomain> result
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/NameMapDomain.java
// public class NameMapDomain {
//
// private String name;
// private Integer id;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/shameful/SessionHolder.java
// public class SessionHolder {
//
// private static SqlSession session = null;
//
// static{
// session = MyBatisConnectionFactory.getSqlSessionFactory().openSession();
// }
//
// public static SqlSession useSession(){
// return session;
// }
//
// }
// Path: ServiceLayer/src/main/java/org/servicelayer/access/NameMapCaller.java
import java.util.List;
import org.servicelayer.models.NameMapDomain;
import org.servicelayer.shameful.SessionHolder;
package org.servicelayer.access;
public class NameMapCaller {
public static List<NameMapDomain> getNameMap() {
List<NameMapDomain> result
|
= SessionHolder.useSession().selectList("NameMap.getPlanetResourceNameMap");
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/persist/SaveSetupDAO.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PersistPlanetDomain.java
// public class PersistPlanetDomain {
// private Integer hashKey;
// private String setup;
// private String lastRefreshDate; //no idea what to do with this
// private Integer version;
//
// public Integer calculateHashKey(){
// if(setup == null){
// return null;
// }
// hashKey = setup.hashCode();
// return getHashKey();
// }
// public Integer getHashKey() {
// return hashKey;
// }
// public void setHashKey(Integer hashKey) {
// this.hashKey = hashKey;
// }
// public String getSetup() {
// return setup;
// }
// public void setSetup(String setup) {
// this.setup = setup;
// }
// public String getLastRefreshDate() {
// return lastRefreshDate;
// }
// public void setLastRefreshDate(String lastRefreshDate) {
// this.lastRefreshDate = lastRefreshDate;
// }
// public Integer getVersion() {
// return version;
// }
// public void setVersion(Integer version) {
// this.version = version;
// }
// }
//
// Path: planetary/src/main/java/org/planetary/persist/SavePlanetService.java
// public enum ResponseCodes{
// //no, I don't know why I'm doing this. Doesn't matter had success
// SUCCESS(0, "Success"),
// FAILURE(1, "Unqualified Failure"),
// EXISTS(2, "Setup Hash Exists"),
// COLLISION(3, "Hash Collision, please kill the developer");
//
// private int code;
// private String message;
// private ResponseCodes(int code, String message){
// this.code = code;
// this.message = message;
// }
// public int getCode(){
// return code;
// }
// public String getMessage(){
// return message;
// }
// }
|
import java.io.IOException;
import org.servicelayer.models.PersistPlanetDomain;
import org.springframework.ui.ModelMap;
import org.planetary.persist.SavePlanetService.ResponseCodes;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
|
package org.planetary.persist;
public class SaveSetupDAO {
public static String persistSetupAndGetUrl(CompleteSetupContainer jsonSetup){
//TODO: Make all return null statements into throw exceptions. Add logging.
String saveString = null;
// ObjectWriter ow = new ObjectMapper().writer();//.withDefaultPrettyPrinter();
ObjectMapper ow = new ObjectMapper();
try {
saveString = ow.writeValueAsString(jsonSetup);
//logger?
// System.out.println("SaveSetupDAO | persistSetupAndGetURL | Setup String: "
// + saveString);
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/PersistPlanetDomain.java
// public class PersistPlanetDomain {
// private Integer hashKey;
// private String setup;
// private String lastRefreshDate; //no idea what to do with this
// private Integer version;
//
// public Integer calculateHashKey(){
// if(setup == null){
// return null;
// }
// hashKey = setup.hashCode();
// return getHashKey();
// }
// public Integer getHashKey() {
// return hashKey;
// }
// public void setHashKey(Integer hashKey) {
// this.hashKey = hashKey;
// }
// public String getSetup() {
// return setup;
// }
// public void setSetup(String setup) {
// this.setup = setup;
// }
// public String getLastRefreshDate() {
// return lastRefreshDate;
// }
// public void setLastRefreshDate(String lastRefreshDate) {
// this.lastRefreshDate = lastRefreshDate;
// }
// public Integer getVersion() {
// return version;
// }
// public void setVersion(Integer version) {
// this.version = version;
// }
// }
//
// Path: planetary/src/main/java/org/planetary/persist/SavePlanetService.java
// public enum ResponseCodes{
// //no, I don't know why I'm doing this. Doesn't matter had success
// SUCCESS(0, "Success"),
// FAILURE(1, "Unqualified Failure"),
// EXISTS(2, "Setup Hash Exists"),
// COLLISION(3, "Hash Collision, please kill the developer");
//
// private int code;
// private String message;
// private ResponseCodes(int code, String message){
// this.code = code;
// this.message = message;
// }
// public int getCode(){
// return code;
// }
// public String getMessage(){
// return message;
// }
// }
// Path: planetary/src/main/java/org/planetary/persist/SaveSetupDAO.java
import java.io.IOException;
import org.servicelayer.models.PersistPlanetDomain;
import org.springframework.ui.ModelMap;
import org.planetary.persist.SavePlanetService.ResponseCodes;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
package org.planetary.persist;
public class SaveSetupDAO {
public static String persistSetupAndGetUrl(CompleteSetupContainer jsonSetup){
//TODO: Make all return null statements into throw exceptions. Add logging.
String saveString = null;
// ObjectWriter ow = new ObjectMapper().writer();//.withDefaultPrettyPrinter();
ObjectMapper ow = new ObjectMapper();
try {
saveString = ow.writeValueAsString(jsonSetup);
//logger?
// System.out.println("SaveSetupDAO | persistSetupAndGetURL | Setup String: "
// + saveString);
|
PersistPlanetDomain planetSetup = new PersistPlanetDomain();
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
|
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
|
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
// Path: planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
|
public FullInfoDomain testController(){
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
|
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
|
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
// Path: planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
|
SchematicDAO.getSchematicsMap(),
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
|
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
|
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
SchematicDAO.getSchematicsMap(),
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
// Path: planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
SchematicDAO.getSchematicsMap(),
|
PlanetDAO.getPlanets(),
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
|
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
|
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
SchematicDAO.getSchematicsMap(),
PlanetDAO.getPlanets(),
PlanetDAO.getResources(),
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
// Path: planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
SchematicDAO.getSchematicsMap(),
PlanetDAO.getPlanets(),
PlanetDAO.getResources(),
|
NameMapDAO.getNames(),
|
Kurt-Midas/EveGadgets
|
planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
|
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
|
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
SchematicDAO.getSchematicsMap(),
PlanetDAO.getPlanets(),
PlanetDAO.getResources(),
NameMapDAO.getNames(),
|
// Path: ServiceLayer/src/main/java/org/servicelayer/models/FullInfoDomain.java
// public class FullInfoDomain {
// // private List<PinCostDomain> pinCosts; //actually should be a map?
// //schematics
//
// private Map<Integer, SchematicDomain> schematicMap;
// private Map<Integer, PlanetDomain> planetMap;
// private Map<Integer, ResourceDomain> resourceMap;
// private Map<String, Integer> nameMap;
// private Map<Integer, ItemDetailsDomain> itemDetails;
//
// public FullInfoDomain(
// Map<Integer, SchematicDomain> schematicMap,
// Map<Integer, PlanetDomain> planetMap,
// Map<Integer, ResourceDomain> resourceMap,
// Map<String, Integer> nameMap,
// Map<Integer, ItemDetailsDomain> itemDetails){
// this.setSchematicMap(schematicMap);
// this.setPlanetMap(planetMap);
// this.setResourceMap(resourceMap);
// this.setNameMap(nameMap);
// this.setItemDetails(itemDetails);
// }
//
// public Map<Integer, SchematicDomain> getSchematicMap() {
// return schematicMap;
// }
//
// public void setSchematicMap(Map<Integer, SchematicDomain> schematicMap) {
// this.schematicMap = schematicMap;
// }
//
// public Map<String, Integer> getNameMap() {
// return nameMap;
// }
//
// public void setNameMap(Map<String, Integer> nameMap) {
// this.nameMap = nameMap;
// }
//
// public Map<Integer, ItemDetailsDomain> getItemDetails() {
// return itemDetails;
// }
//
// public void setItemDetails(Map<Integer, ItemDetailsDomain> itemDetails) {
// this.itemDetails = itemDetails;
// }
//
// public Map<Integer, PlanetDomain> getPlanetMap() {
// return planetMap;
// }
//
// public void setPlanetMap(Map<Integer, PlanetDomain> planetMap) {
// this.planetMap = planetMap;
// }
//
// public Map<Integer, ResourceDomain> getResourceMap() {
// return resourceMap;
// }
//
// public void setResourceMap(Map<Integer, ResourceDomain> resourceMap) {
// this.resourceMap = resourceMap;
// }
//
// //have a verify function somewhere?
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/ItemDetailsDAO.java
// public class ItemDetailsDAO {
//
//
// public static Map<Integer, ItemDetailsDomain> getItemDetails(){
// List<ItemDetailsDomain> itemDetailsList = ItemDetailsCalls.getItemDetailsList();
// //session.selectList("ItemDetails.getItemDetailsList");
// Map<Integer, ItemDetailsDomain> resultMap = new HashMap<Integer, ItemDetailsDomain>();
// for(ItemDetailsDomain d : itemDetailsList){
// resultMap.put(d.getTypeID(), d);
// }
// return resultMap;
// }
//
// public static List<ImportantItemDetailsDomain> getImportantItemDetails(List<Integer> itemIdList){
// List<ImportantItemDetailsDomain> detailsList = ItemDetailsCalls.getImportantItemDetails(itemIdList);
// // Map<Integer, ImportantItemDetailsDomain> resultMap = new HashMap<Integer, ImportantItemDetailsDomain>();
// // for(ImportantItemDetailsDomain d : detailsList){
// // resultMap.put(d.getTypeId(), d);
// // }
// return detailsList;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/NameMapDAO.java
// public class NameMapDAO {
//
// public static Map<String, Integer> getNames(){
// List<NameMapDomain> names = NameMapCaller.getNameMap();
// Map<String, Integer> nameMap = new HashMap<String, Integer>();
// for(NameMapDomain m: names){
// nameMap.put(m.getName(), m.getId());
// }
// return nameMap;
// }
//
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/PlanetDAO.java
// public class PlanetDAO {
//
//
// public static Map<Integer,PlanetDomain> getPlanets(){
// List<PlanetDomain> planetList = PlanetsCaller.getPlanets();
// Map<Integer, PlanetDomain> planetMap = new HashMap<Integer, PlanetDomain>();
// for(PlanetDomain p: planetList){
// planetMap.put(p.getId(), p);
// }
// return planetMap;
// }
//
// public static Map<Integer, ResourceDomain> getResources(){
// List<ResourceDomain> resourceList = PlanetsCaller.getResources();
// Map<Integer, ResourceDomain> resourceMap = new HashMap<Integer, ResourceDomain>();
// for(ResourceDomain r: resourceList){
// resourceMap.put(r.getId(), r);
// }
// return resourceMap;
// }
// }
//
// Path: ServiceLayer/src/main/java/org/servicelayer/service/SchematicDAO.java
// public class SchematicDAO {
//
// public static Map<Integer, SchematicDomain> getSchematicsMap(){
// List<SchematicDomain> schematicsList = PlanetSchematicsCaller.getSchematicsList();
// Map<Integer, SchematicDomain> schematicsMap = new HashMap<Integer, SchematicDomain>();
// for(SchematicDomain s: schematicsList){
// schematicsMap.put(s.getOutputID(), s);
// }
// return schematicsMap;
// }
// }
// Path: planetary/src/main/java/org/planetary/controllers/PlanetaryController.java
import org.servicelayer.models.FullInfoDomain;
import org.servicelayer.service.ItemDetailsDAO;
import org.servicelayer.service.NameMapDAO;
import org.servicelayer.service.PlanetDAO;
import org.servicelayer.service.SchematicDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
package org.planetary.controllers;
@RestController
@RequestMapping("/planetary")
public class PlanetaryController {
@RequestMapping("")
public FullInfoDomain testController(){
return new FullInfoDomain(
SchematicDAO.getSchematicsMap(),
PlanetDAO.getPlanets(),
PlanetDAO.getResources(),
NameMapDAO.getNames(),
|
ItemDetailsDAO.getItemDetails());
|
MX-Futhark/hook-any-text
|
src/main/java/hextostring/debug/DebuggableHexSelectionsContent.java
|
// Path: src/main/java/hexcapture/HexSelectionsContentSnapshot.java
// public class HexSelectionsContentSnapshot {
//
// private static final String STRING_REPRESENTATION_SEPARATOR = "|";
//
// protected HexSelections selections;
// protected Map<HexSelection, String> selectionValues;
//
// protected HexSelectionsContentSnapshot() {}
//
// /**
// * Getter on the value of a selection by its index
// * @param index
// * @return
// */
// public String getValueAt(int index) {
// return selectionValues.get(selections.get(index));
// }
//
// /**
// * Getter on the id of a selection by its index
// * @param index
// * @return
// */
// public int getSelectionIdAt(int index) {
// return selections.get(index).getId();
// }
//
// /**
// * Getter on the start index of a selection by its index
// * @param index
// * @return
// */
// public long getSelectionStartAt(int index) {
// return selections.get(index).getStart();
// }
//
// /**
// * Getter on the end index of a selection by its index
// * @param index
// * @return
// */
// public long getSelectionEndAt(int index) {
// return selections.get(index).getEnd();
// }
//
// /**
// * Getter on the index of the active selection
// * @return
// */
// public int getActiveSelectionIndex() {
// return selections.getActiveSelectionIndex();
// }
//
// /**
// * Getter on the size of the selection collection
// * @return
// */
// public int getSize() {
// return selections.getAll().size();
// }
//
// @Override
// public String toString() {
// StringBuilder res = new StringBuilder();
// for (HexSelection s : selections.getAll()) {
// res.append(selectionValues.get(s));
// if (s != selections.getAll().get(getSize() - 1)) {
// res.append(STRING_REPRESENTATION_SEPARATOR);
// }
// }
// return res.toString();
// }
//
// }
//
// Path: src/main/java/hextostring/format/DecorableList.java
// public interface DecorableList {
//
// public void setDecorationBefore(String decoration);
//
// public void setDecorationBetween(String decoration);
//
// public void setDecorationAfter(String decoration);
//
// public void setLinesDecorations(String before, String after);
//
// }
|
import java.util.List;
import hexcapture.HexSelectionsContentSnapshot;
import hextostring.format.DecorableList;
|
package hextostring.debug;
/**
* Wraps the content of hex selections into an object containing the necessary
* information for debugging
*
* @author Maxime PIA
*/
public class DebuggableHexSelectionsContent implements DebuggableStrings,
DecorableList {
|
// Path: src/main/java/hexcapture/HexSelectionsContentSnapshot.java
// public class HexSelectionsContentSnapshot {
//
// private static final String STRING_REPRESENTATION_SEPARATOR = "|";
//
// protected HexSelections selections;
// protected Map<HexSelection, String> selectionValues;
//
// protected HexSelectionsContentSnapshot() {}
//
// /**
// * Getter on the value of a selection by its index
// * @param index
// * @return
// */
// public String getValueAt(int index) {
// return selectionValues.get(selections.get(index));
// }
//
// /**
// * Getter on the id of a selection by its index
// * @param index
// * @return
// */
// public int getSelectionIdAt(int index) {
// return selections.get(index).getId();
// }
//
// /**
// * Getter on the start index of a selection by its index
// * @param index
// * @return
// */
// public long getSelectionStartAt(int index) {
// return selections.get(index).getStart();
// }
//
// /**
// * Getter on the end index of a selection by its index
// * @param index
// * @return
// */
// public long getSelectionEndAt(int index) {
// return selections.get(index).getEnd();
// }
//
// /**
// * Getter on the index of the active selection
// * @return
// */
// public int getActiveSelectionIndex() {
// return selections.getActiveSelectionIndex();
// }
//
// /**
// * Getter on the size of the selection collection
// * @return
// */
// public int getSize() {
// return selections.getAll().size();
// }
//
// @Override
// public String toString() {
// StringBuilder res = new StringBuilder();
// for (HexSelection s : selections.getAll()) {
// res.append(selectionValues.get(s));
// if (s != selections.getAll().get(getSize() - 1)) {
// res.append(STRING_REPRESENTATION_SEPARATOR);
// }
// }
// return res.toString();
// }
//
// }
//
// Path: src/main/java/hextostring/format/DecorableList.java
// public interface DecorableList {
//
// public void setDecorationBefore(String decoration);
//
// public void setDecorationBetween(String decoration);
//
// public void setDecorationAfter(String decoration);
//
// public void setLinesDecorations(String before, String after);
//
// }
// Path: src/main/java/hextostring/debug/DebuggableHexSelectionsContent.java
import java.util.List;
import hexcapture.HexSelectionsContentSnapshot;
import hextostring.format.DecorableList;
package hextostring.debug;
/**
* Wraps the content of hex selections into an object containing the necessary
* information for debugging
*
* @author Maxime PIA
*/
public class DebuggableHexSelectionsContent implements DebuggableStrings,
DecorableList {
|
private HexSelectionsContentSnapshot snapshot;
|
MX-Futhark/hook-any-text
|
src/main/java/gui/views/components/ClickableURL.java
|
// Path: src/main/java/gui/utils/GUIErrorHandler.java
// public class GUIErrorHandler {
//
// public GUIErrorHandler(Exception e) {
// // TODO
// e.printStackTrace();
// }
//
// }
|
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JButton;
import gui.utils.GUIErrorHandler;
|
package gui.views.components;
/**
* Button associated to an URL and opening the user's web browser on click.
*
* @author Maxime PIA
*/
@SuppressWarnings("serial")
public class ClickableURL extends JButton {
public ClickableURL(final String url, String text) {
setText("<html><a href='" + url + "'>" + text + "</a></html>");
setOpaque(false);
setContentAreaFilled(false);
setBorderPainted(false);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
try {
Desktop.getDesktop().browse(new URI(url));
} catch (URISyntaxException | IOException er) {
|
// Path: src/main/java/gui/utils/GUIErrorHandler.java
// public class GUIErrorHandler {
//
// public GUIErrorHandler(Exception e) {
// // TODO
// e.printStackTrace();
// }
//
// }
// Path: src/main/java/gui/views/components/ClickableURL.java
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JButton;
import gui.utils.GUIErrorHandler;
package gui.views.components;
/**
* Button associated to an URL and opening the user's web browser on click.
*
* @author Maxime PIA
*/
@SuppressWarnings("serial")
public class ClickableURL extends JButton {
public ClickableURL(final String url, String text) {
setText("<html><a href='" + url + "'>" + text + "</a></html>");
setOpaque(false);
setContentAreaFilled(false);
setBorderPainted(false);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
try {
Desktop.getDesktop().browse(new URI(url));
} catch (URISyntaxException | IOException er) {
|
new GUIErrorHandler(er);
|
MX-Futhark/hook-any-text
|
src/main/java/hextostring/replacement/HexToStrStrategy.java
|
// Path: src/main/java/hextostring/utils/Hex.java
// public class Hex {
//
// /**
// * Converts a hexadecimal string into a readable string.
// *
// * @param hex
// * The hexadecimal string.
// * @param charset
// * The charset used for the convertion.
// * @return The readable string.
// */
// public static String convertToString(String hex, Charset charset) {
// return byteListToString(HexStringToByteList(hex), charset);
// }
//
// private static String byteArrayToString(byte[] data, Charset charset) {
// return new String(data, charset);
// }
//
// private static String byteListToString(List<Byte> data, Charset charset) {
// byte[] arrayData = new byte[data.size()];
// int cmpt = 0;
// for (Byte b : data) {
// arrayData[cmpt++] = b;
// }
// return byteArrayToString(arrayData, charset);
// }
//
// private static List<Byte> HexStringToByteList(String hex) {
// List<Byte> byteList = new LinkedList<>();
// boolean littleEnd = false;
// int currVal = 0;
// for (int i = 0; i < hex.length(); ++i) {
// if (littleEnd) {
// currVal = currVal | (Character.digit(hex.charAt(i), 16));
// } else {
// currVal = (Character.digit(hex.charAt(i), 16)) << 4;
// }
// if (littleEnd) {
// byteList.add((byte) (currVal & 0xFF));
// }
// littleEnd = !littleEnd;
// }
//
// return byteList;
// }
//
// }
|
import java.nio.charset.Charset;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import hextostring.utils.Hex;
|
package hextostring.replacement;
/**
* Replaces hexadecimal sequences and patterns by readable characters between
* minus signs. A string in such an intermediary state will be called an
* transitory string, or mixed string.
*
* @author Maxime PIA
*/
public class HexToStrStrategy extends ReplacementStrategy {
@Override
public String replacePattern(String s, String pattern, String replacement) {
// captured patterns will be converted
return s.replaceAll(pattern, "-" + replacement.replace("-", "\\-")
// isolates group references not preceded by an antislash
.replaceAll("(?<!\\\\)(\\$[0-9]*)", "-$1-") + "-");
}
@Override
public String replaceSequence(String s, String sequence,
String replacement) {
return s.replace(sequence, "-" + replacement.replace("-", "\\-") + "-");
}
/**
* Converts a transitory string into a completely readable string.
*
* @param s
* The string to convert.
* @param cs
* The charset used to convert s.
* @return A completely readable string.
*/
public static String toReadableString(String s, Charset cs) {
List<String> parts = splitParts(s);
StringBuilder noHexString = new StringBuilder();
boolean hexPart = true;
for (String part : parts) {
if (hexPart) {
|
// Path: src/main/java/hextostring/utils/Hex.java
// public class Hex {
//
// /**
// * Converts a hexadecimal string into a readable string.
// *
// * @param hex
// * The hexadecimal string.
// * @param charset
// * The charset used for the convertion.
// * @return The readable string.
// */
// public static String convertToString(String hex, Charset charset) {
// return byteListToString(HexStringToByteList(hex), charset);
// }
//
// private static String byteArrayToString(byte[] data, Charset charset) {
// return new String(data, charset);
// }
//
// private static String byteListToString(List<Byte> data, Charset charset) {
// byte[] arrayData = new byte[data.size()];
// int cmpt = 0;
// for (Byte b : data) {
// arrayData[cmpt++] = b;
// }
// return byteArrayToString(arrayData, charset);
// }
//
// private static List<Byte> HexStringToByteList(String hex) {
// List<Byte> byteList = new LinkedList<>();
// boolean littleEnd = false;
// int currVal = 0;
// for (int i = 0; i < hex.length(); ++i) {
// if (littleEnd) {
// currVal = currVal | (Character.digit(hex.charAt(i), 16));
// } else {
// currVal = (Character.digit(hex.charAt(i), 16)) << 4;
// }
// if (littleEnd) {
// byteList.add((byte) (currVal & 0xFF));
// }
// littleEnd = !littleEnd;
// }
//
// return byteList;
// }
//
// }
// Path: src/main/java/hextostring/replacement/HexToStrStrategy.java
import java.nio.charset.Charset;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import hextostring.utils.Hex;
package hextostring.replacement;
/**
* Replaces hexadecimal sequences and patterns by readable characters between
* minus signs. A string in such an intermediary state will be called an
* transitory string, or mixed string.
*
* @author Maxime PIA
*/
public class HexToStrStrategy extends ReplacementStrategy {
@Override
public String replacePattern(String s, String pattern, String replacement) {
// captured patterns will be converted
return s.replaceAll(pattern, "-" + replacement.replace("-", "\\-")
// isolates group references not preceded by an antislash
.replaceAll("(?<!\\\\)(\\$[0-9]*)", "-$1-") + "-");
}
@Override
public String replaceSequence(String s, String sequence,
String replacement) {
return s.replace(sequence, "-" + replacement.replace("-", "\\-") + "-");
}
/**
* Converts a transitory string into a completely readable string.
*
* @param s
* The string to convert.
* @param cs
* The charset used to convert s.
* @return A completely readable string.
*/
public static String toReadableString(String s, Charset cs) {
List<String> parts = splitParts(s);
StringBuilder noHexString = new StringBuilder();
boolean hexPart = true;
for (String part : parts) {
if (hexPart) {
|
noHexString.append(Hex.convertToString(part, cs));
|
MX-Futhark/hook-any-text
|
src/main/java/hextostring/convert/SJISConverter.java
|
// Path: src/main/java/hextostring/utils/Charsets.java
// public class Charsets implements ValueClass {
//
// // Charsets used in Japanese games
// @CommandLineValue(
// value = "sjis",
// shortcut = "j",
// description = "Shift JIS"
// )
// public static final Charset SHIFT_JIS = Charset.forName("Shift_JIS");
// @CommandLineValue(
// value = "utf16-le",
// shortcut = "l",
// description = "UTF16 Little Endian"
// )
// public static final Charset UTF16_LE = Charset.forName("UTF-16LE");
// @CommandLineValue(
// value = "utf16-be",
// shortcut = "b",
// description = "UTF16 Bid Endian"
// )
// public static final Charset UTF16_BE = Charset.forName("UTF-16BE");
// // also used for test files
// @CommandLineValue(
// value = "utf8",
// shortcut = "u",
// description = "UTF8"
// )
// public static final Charset UTF8 = Charset.forName("UTF-8");
//
// // not a charset, used for automatic recognition
// @CommandLineValue(
// value = "detect",
// shortcut = "d",
// description = "Detect the right encoding among the other ones"
// )
// public static final Charset DETECT = CharsetAutodetect.getInstance();
//
// public static final Charset[] ALL_CHARSETS = getAllCharsets();
//
// public static Charset getValidCharset(String charsetName) {
// for (Charset cs : ALL_CHARSETS) {
// if (cs.name().equals(charsetName)) {
// return cs;
// }
// }
// return null;
// }
//
// private static Charset[] getAllCharsets() {
//
// List<Field> charsetFields = ReflectionUtils.getAnnotatedFields(
// Charsets.class,
// CommandLineValue.class
// );
// Charset[] allCharsets = new Charset[charsetFields.size()];
// int eltCounter = 0;
// for (Field charsetField : charsetFields) {
// try {
// allCharsets[eltCounter++] = (Charset) charsetField.get(null);
// } catch (IllegalArgumentException | IllegalAccessException e) {
// e.printStackTrace();
// }
// }
// return allCharsets;
// }
//
// }
|
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import hextostring.utils.Charsets;
|
package hextostring.convert;
/**
* Standard converter for Shift-JIS-encoded hexadecimal strings.
*
* @author Maxime PIA
*/
public class SJISConverter extends AbstractConverter {
public SJISConverter() {
|
// Path: src/main/java/hextostring/utils/Charsets.java
// public class Charsets implements ValueClass {
//
// // Charsets used in Japanese games
// @CommandLineValue(
// value = "sjis",
// shortcut = "j",
// description = "Shift JIS"
// )
// public static final Charset SHIFT_JIS = Charset.forName("Shift_JIS");
// @CommandLineValue(
// value = "utf16-le",
// shortcut = "l",
// description = "UTF16 Little Endian"
// )
// public static final Charset UTF16_LE = Charset.forName("UTF-16LE");
// @CommandLineValue(
// value = "utf16-be",
// shortcut = "b",
// description = "UTF16 Bid Endian"
// )
// public static final Charset UTF16_BE = Charset.forName("UTF-16BE");
// // also used for test files
// @CommandLineValue(
// value = "utf8",
// shortcut = "u",
// description = "UTF8"
// )
// public static final Charset UTF8 = Charset.forName("UTF-8");
//
// // not a charset, used for automatic recognition
// @CommandLineValue(
// value = "detect",
// shortcut = "d",
// description = "Detect the right encoding among the other ones"
// )
// public static final Charset DETECT = CharsetAutodetect.getInstance();
//
// public static final Charset[] ALL_CHARSETS = getAllCharsets();
//
// public static Charset getValidCharset(String charsetName) {
// for (Charset cs : ALL_CHARSETS) {
// if (cs.name().equals(charsetName)) {
// return cs;
// }
// }
// return null;
// }
//
// private static Charset[] getAllCharsets() {
//
// List<Field> charsetFields = ReflectionUtils.getAnnotatedFields(
// Charsets.class,
// CommandLineValue.class
// );
// Charset[] allCharsets = new Charset[charsetFields.size()];
// int eltCounter = 0;
// for (Field charsetField : charsetFields) {
// try {
// allCharsets[eltCounter++] = (Charset) charsetField.get(null);
// } catch (IllegalArgumentException | IllegalAccessException e) {
// e.printStackTrace();
// }
// }
// return allCharsets;
// }
//
// }
// Path: src/main/java/hextostring/convert/SJISConverter.java
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import hextostring.utils.Charsets;
package hextostring.convert;
/**
* Standard converter for Shift-JIS-encoded hexadecimal strings.
*
* @author Maxime PIA
*/
public class SJISConverter extends AbstractConverter {
public SJISConverter() {
|
super(Charsets.SHIFT_JIS);
|
MX-Futhark/hook-any-text
|
src/main/java/gui/views/components/HidableOKCancelDialog.java
|
// Path: src/main/java/gui/GUIOptions.java
// public class GUIOptions extends Options implements Serializable {
//
// /**
// * Backward-compatible with 0.7.0
// */
// private static final long serialVersionUID = 00000000007000000L;
//
// private static final Set<Integer> DEFAULT_HIDDEN_DIALOG_IDS =
// new HashSet<>();
// private Set<Integer> hiddenDialogIDs = DEFAULT_HIDDEN_DIALOG_IDS;
//
// public GUIOptions() {
// super();
// }
//
// /**
// * Definitely hides the dialog identified by the parameter.
// *
// * @param id
// * The number used to identified the dialog.
// */
// public void addHiddenDialog(int id) {
// hiddenDialogIDs.add(id);
// }
//
// /**
// * Determines whether a dialog is hidden or not.
// *
// * @param id
// * The number used to identified the dialog.
// * @return True if the dialog is hidden.
// */
// public boolean isDialogHidden(int id) {
// return hiddenDialogIDs.contains(id);
// }
//
// }
|
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import gui.GUIOptions;
|
package gui.views.components;
/**
* Confirmation dialog that can be definitely hidden.
*
* @author Maixme PIA
*/
public class HidableOKCancelDialog {
public static final int CLOSE_CONFIRM = 0;
public static final String CLOSE_CONFIRM_MESSAGE =
"Hook Any Text will be closed. "
+ "You can open it again from Cheat Egine's File menu.";
private int id;
private JPanel body;
private Component parent;
|
// Path: src/main/java/gui/GUIOptions.java
// public class GUIOptions extends Options implements Serializable {
//
// /**
// * Backward-compatible with 0.7.0
// */
// private static final long serialVersionUID = 00000000007000000L;
//
// private static final Set<Integer> DEFAULT_HIDDEN_DIALOG_IDS =
// new HashSet<>();
// private Set<Integer> hiddenDialogIDs = DEFAULT_HIDDEN_DIALOG_IDS;
//
// public GUIOptions() {
// super();
// }
//
// /**
// * Definitely hides the dialog identified by the parameter.
// *
// * @param id
// * The number used to identified the dialog.
// */
// public void addHiddenDialog(int id) {
// hiddenDialogIDs.add(id);
// }
//
// /**
// * Determines whether a dialog is hidden or not.
// *
// * @param id
// * The number used to identified the dialog.
// * @return True if the dialog is hidden.
// */
// public boolean isDialogHidden(int id) {
// return hiddenDialogIDs.contains(id);
// }
//
// }
// Path: src/main/java/gui/views/components/HidableOKCancelDialog.java
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import gui.GUIOptions;
package gui.views.components;
/**
* Confirmation dialog that can be definitely hidden.
*
* @author Maixme PIA
*/
public class HidableOKCancelDialog {
public static final int CLOSE_CONFIRM = 0;
public static final String CLOSE_CONFIRM_MESSAGE =
"Hook Any Text will be closed. "
+ "You can open it again from Cheat Egine's File menu.";
private int id;
private JPanel body;
private Component parent;
|
private GUIOptions opts;
|
MX-Futhark/hook-any-text
|
src/main/java/main/utils/ReflectionUtils.java
|
// Path: src/main/java/gui/utils/GUIErrorHandler.java
// public class GUIErrorHandler {
//
// public GUIErrorHandler(Exception e) {
// // TODO
// e.printStackTrace();
// }
//
// }
|
import java.awt.Component;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JSpinner;
import gui.utils.GUIErrorHandler;
|
boolean setter) {
String accessorPrefix = setter ? "set" : "get";
Class<?>[] args = new Class<?>[0];
try {
if (elt instanceof JCheckBox) {
if (setter) {
args = new Class<?>[]{boolean.class};
} else {
accessorPrefix = "is";
}
return elt.getClass().getMethod(
accessorPrefix + "Selected",
args
);
} else if (elt instanceof JComboBox
|| elt instanceof JSpinner) {
if (setter) {
args = new Class<?>[]{Object.class};
}
String accessorSuffix = elt instanceof JComboBox
? "SelectedItem"
: "Value";
return elt.getClass().getMethod(
accessorPrefix + accessorSuffix,
args
);
}
} catch (NoSuchMethodException | SecurityException e) {
|
// Path: src/main/java/gui/utils/GUIErrorHandler.java
// public class GUIErrorHandler {
//
// public GUIErrorHandler(Exception e) {
// // TODO
// e.printStackTrace();
// }
//
// }
// Path: src/main/java/main/utils/ReflectionUtils.java
import java.awt.Component;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JSpinner;
import gui.utils.GUIErrorHandler;
boolean setter) {
String accessorPrefix = setter ? "set" : "get";
Class<?>[] args = new Class<?>[0];
try {
if (elt instanceof JCheckBox) {
if (setter) {
args = new Class<?>[]{boolean.class};
} else {
accessorPrefix = "is";
}
return elt.getClass().getMethod(
accessorPrefix + "Selected",
args
);
} else if (elt instanceof JComboBox
|| elt instanceof JSpinner) {
if (setter) {
args = new Class<?>[]{Object.class};
}
String accessorSuffix = elt instanceof JComboBox
? "SelectedItem"
: "Value";
return elt.getClass().getMethod(
accessorPrefix + accessorSuffix,
args
);
}
} catch (NoSuchMethodException | SecurityException e) {
|
new GUIErrorHandler(e);
|
MX-Futhark/hook-any-text
|
src/main/java/hextostring/evaluate/string/JapaneseStringEvaluator.java
|
// Path: src/main/java/hextostring/evaluate/EvaluationResult.java
// public class EvaluationResult {
//
// private int mark;
// private String details;
//
// public EvaluationResult(int mark, String details) {
// this.mark = mark;
// this.details = details;
// }
//
// /**
// * Getter on the mark obtained by the object.
// *
// * @return the mark obtained by the object.
// */
// public int getMark() {
// return mark;
// }
//
// /**
// * Getter on the details of the evaluation.
// *
// * @return the details of the evaluation.
// */
// public String getDetails() {
// return details;
// }
//
// }
|
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import hextostring.evaluate.EvaluationResult;
|
return match.length();
}
private boolean hasFinalPunctuation(String s) {
if (s.length() == 0) return false;
String lastChar = s.substring(s.length() - 1);
for (String punctuation : JAPANESE_PUNCTUATION) {
if (lastChar.matches(punctuation)) {
return true;
}
}
return false;
}
private int getNbPunctuation(String s) {
int total = 0;
for (int i = 0; i < s.length(); ++i) {
for (String punctuation : JAPANESE_PUNCTUATION) {
if ((s.charAt(i) + "").matches(punctuation)) {
++total;
break;
}
}
}
return total;
}
@Override
|
// Path: src/main/java/hextostring/evaluate/EvaluationResult.java
// public class EvaluationResult {
//
// private int mark;
// private String details;
//
// public EvaluationResult(int mark, String details) {
// this.mark = mark;
// this.details = details;
// }
//
// /**
// * Getter on the mark obtained by the object.
// *
// * @return the mark obtained by the object.
// */
// public int getMark() {
// return mark;
// }
//
// /**
// * Getter on the details of the evaluation.
// *
// * @return the details of the evaluation.
// */
// public String getDetails() {
// return details;
// }
//
// }
// Path: src/main/java/hextostring/evaluate/string/JapaneseStringEvaluator.java
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import hextostring.evaluate.EvaluationResult;
return match.length();
}
private boolean hasFinalPunctuation(String s) {
if (s.length() == 0) return false;
String lastChar = s.substring(s.length() - 1);
for (String punctuation : JAPANESE_PUNCTUATION) {
if (lastChar.matches(punctuation)) {
return true;
}
}
return false;
}
private int getNbPunctuation(String s) {
int total = 0;
for (int i = 0; i < s.length(); ++i) {
for (String punctuation : JAPANESE_PUNCTUATION) {
if ((s.charAt(i) + "").matches(punctuation)) {
++total;
break;
}
}
}
return total;
}
@Override
|
public EvaluationResult evaluate(String s) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.