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
|
---|---|---|---|---|---|---|
jbgi/eventsrc4j | core/src/test/java/eventsrc4j/EventStorageSpec.java | // Path: core/src/main/java/eventsrc4j/io/EventStorage.java
// public interface EventStorage<K, S, E> {
//
// /**
// * Access a specific stream.
// *
// * @param key the stream key
// * @return a readable and writable
// */
// WritableEventStream<K, S, E> stream(K key);
//
// default <KK, SS, EE> EventStorage<KK, SS, EE> xmap(F<K, KK> kk, F<KK, K> k,
// F<S, SS> ss, F<SS, S> s, F<E, EE> ee,
// F<EE, E> e) {
//
// //TODO
// throw new UnsupportedOperationException();
// }
// }
//
// Path: core/src/main/java/eventsrc4j/io/WritableEventStream.java
// public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
//
// /**
// * Save the given events at the end of the stream, if at expected sequence.
// *
// * @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
// * expected to be empty.
// * @param time timestamp of the events to save.
// * @param events a list of events to save in the stream.
// * @return an IO action producing the result of the write; either successful or indicating an
// * optimistic concurrency error (duplicated sequence).
// */
// IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
//
// default <R> IO<R> evalWAction(WStreamAction<K, S, E, R> action) {
// return action.eval(WStreamIOAlgebra.of(this));
// }
//
//
// }
| import eventsrc4j.io.EventStorage;
import eventsrc4j.io.WritableEventStream;
import fj.data.List;
import fj.data.Option;
import fj.test.Gen;
import fj.test.Property;
import java.time.Instant;
import java.util.function.Function;
import java.util.function.Predicate;
import static fj.data.List.nil;
import static fj.data.List.single;
import static fj.data.Option.none;
import static fj.test.Property.prop;
import static fj.test.Property.property;
import static java.util.Collections.singletonList; | package eventsrc4j;
public final class EventStorageSpec<K, S, E> implements WStreamAction.Factory<K, S, E> {
private final Gen<K> keys;
private final Gen<E> events;
public EventStorageSpec(Gen<K> keys, Gen<E> events) {
this.keys = keys;
this.events = events;
}
| // Path: core/src/main/java/eventsrc4j/io/EventStorage.java
// public interface EventStorage<K, S, E> {
//
// /**
// * Access a specific stream.
// *
// * @param key the stream key
// * @return a readable and writable
// */
// WritableEventStream<K, S, E> stream(K key);
//
// default <KK, SS, EE> EventStorage<KK, SS, EE> xmap(F<K, KK> kk, F<KK, K> k,
// F<S, SS> ss, F<SS, S> s, F<E, EE> ee,
// F<EE, E> e) {
//
// //TODO
// throw new UnsupportedOperationException();
// }
// }
//
// Path: core/src/main/java/eventsrc4j/io/WritableEventStream.java
// public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
//
// /**
// * Save the given events at the end of the stream, if at expected sequence.
// *
// * @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
// * expected to be empty.
// * @param time timestamp of the events to save.
// * @param events a list of events to save in the stream.
// * @return an IO action producing the result of the write; either successful or indicating an
// * optimistic concurrency error (duplicated sequence).
// */
// IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
//
// default <R> IO<R> evalWAction(WStreamAction<K, S, E, R> action) {
// return action.eval(WStreamIOAlgebra.of(this));
// }
//
//
// }
// Path: core/src/test/java/eventsrc4j/EventStorageSpec.java
import eventsrc4j.io.EventStorage;
import eventsrc4j.io.WritableEventStream;
import fj.data.List;
import fj.data.Option;
import fj.test.Gen;
import fj.test.Property;
import java.time.Instant;
import java.util.function.Function;
import java.util.function.Predicate;
import static fj.data.List.nil;
import static fj.data.List.single;
import static fj.data.Option.none;
import static fj.test.Property.prop;
import static fj.test.Property.property;
import static java.util.Collections.singletonList;
package eventsrc4j;
public final class EventStorageSpec<K, S, E> implements WStreamAction.Factory<K, S, E> {
private final Gen<K> keys;
private final Gen<E> events;
public EventStorageSpec(Gen<K> keys, Gen<E> events) {
this.keys = keys;
this.events = events;
}
| public Property read_return_write(EventStorage<K, S, E> eventStorage) { |
jbgi/eventsrc4j | core/src/test/java/eventsrc4j/EventStorageSpec.java | // Path: core/src/main/java/eventsrc4j/io/EventStorage.java
// public interface EventStorage<K, S, E> {
//
// /**
// * Access a specific stream.
// *
// * @param key the stream key
// * @return a readable and writable
// */
// WritableEventStream<K, S, E> stream(K key);
//
// default <KK, SS, EE> EventStorage<KK, SS, EE> xmap(F<K, KK> kk, F<KK, K> k,
// F<S, SS> ss, F<SS, S> s, F<E, EE> ee,
// F<EE, E> e) {
//
// //TODO
// throw new UnsupportedOperationException();
// }
// }
//
// Path: core/src/main/java/eventsrc4j/io/WritableEventStream.java
// public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
//
// /**
// * Save the given events at the end of the stream, if at expected sequence.
// *
// * @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
// * expected to be empty.
// * @param time timestamp of the events to save.
// * @param events a list of events to save in the stream.
// * @return an IO action producing the result of the write; either successful or indicating an
// * optimistic concurrency error (duplicated sequence).
// */
// IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
//
// default <R> IO<R> evalWAction(WStreamAction<K, S, E, R> action) {
// return action.eval(WStreamIOAlgebra.of(this));
// }
//
//
// }
| import eventsrc4j.io.EventStorage;
import eventsrc4j.io.WritableEventStream;
import fj.data.List;
import fj.data.Option;
import fj.test.Gen;
import fj.test.Property;
import java.time.Instant;
import java.util.function.Function;
import java.util.function.Predicate;
import static fj.data.List.nil;
import static fj.data.List.single;
import static fj.data.Option.none;
import static fj.test.Property.prop;
import static fj.test.Property.property;
import static java.util.Collections.singletonList; | package eventsrc4j;
public final class EventStorageSpec<K, S, E> implements WStreamAction.Factory<K, S, E> {
private final Gen<K> keys;
private final Gen<E> events;
public EventStorageSpec(Gen<K> keys, Gen<E> events) {
this.keys = keys;
this.events = events;
}
public Property read_return_write(EventStorage<K, S, E> eventStorage) {
return property(keys, events, key -> event -> {
| // Path: core/src/main/java/eventsrc4j/io/EventStorage.java
// public interface EventStorage<K, S, E> {
//
// /**
// * Access a specific stream.
// *
// * @param key the stream key
// * @return a readable and writable
// */
// WritableEventStream<K, S, E> stream(K key);
//
// default <KK, SS, EE> EventStorage<KK, SS, EE> xmap(F<K, KK> kk, F<KK, K> k,
// F<S, SS> ss, F<SS, S> s, F<E, EE> ee,
// F<EE, E> e) {
//
// //TODO
// throw new UnsupportedOperationException();
// }
// }
//
// Path: core/src/main/java/eventsrc4j/io/WritableEventStream.java
// public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
//
// /**
// * Save the given events at the end of the stream, if at expected sequence.
// *
// * @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
// * expected to be empty.
// * @param time timestamp of the events to save.
// * @param events a list of events to save in the stream.
// * @return an IO action producing the result of the write; either successful or indicating an
// * optimistic concurrency error (duplicated sequence).
// */
// IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
//
// default <R> IO<R> evalWAction(WStreamAction<K, S, E, R> action) {
// return action.eval(WStreamIOAlgebra.of(this));
// }
//
//
// }
// Path: core/src/test/java/eventsrc4j/EventStorageSpec.java
import eventsrc4j.io.EventStorage;
import eventsrc4j.io.WritableEventStream;
import fj.data.List;
import fj.data.Option;
import fj.test.Gen;
import fj.test.Property;
import java.time.Instant;
import java.util.function.Function;
import java.util.function.Predicate;
import static fj.data.List.nil;
import static fj.data.List.single;
import static fj.data.Option.none;
import static fj.test.Property.prop;
import static fj.test.Property.property;
import static java.util.Collections.singletonList;
package eventsrc4j;
public final class EventStorageSpec<K, S, E> implements WStreamAction.Factory<K, S, E> {
private final Gen<K> keys;
private final Gen<E> events;
public EventStorageSpec(Gen<K> keys, Gen<E> events) {
this.keys = keys;
this.events = events;
}
public Property read_return_write(EventStorage<K, S, E> eventStorage) {
return property(keys, events, key -> event -> {
| WritableEventStream<K, S, E> stream = eventStorage.stream(key); |
jbgi/eventsrc4j | core/src/main/java/eventsrc4j/io/WritableEventStream.java | // Path: core/src/main/java/eventsrc4j/WStreamAction.java
// @FunctionalInterface
// public interface WStreamAction<K, S, E, R> {
//
// /**
// * Monadic WStreamAction algebra, that is also a StreamAction algebra
// *
// * @param <R> action result type.
// * @param <X> interpreted action result type (eg. wrapped in a container).
// */
// interface Algebra<K, S, E, R, X> extends StreamAction.Algebra<K, S, E, R, X> {
//
// X Write(Option<S> expectedSeq, Instant time, Iterable<E> events, TypeEq<WriteResult<K, S, E>, R> resultType);
//
// <Q> X BindW(WStreamAction<K, S, E, Q> action, F<Q, WStreamAction<K, S, E, R>> function);
//
// // We derive implementation of monadic operations of the StreamAction algebra in term of this WStreamAction algebra:
// @Override
// default <Q> X Bind(StreamAction<K, S, E, Q> action,
// F<Q, StreamAction<K, S, E, R>> function) {
// return BindW(action::eval, compose(a -> a::eval, function));
// }
// }
//
// interface Factory<K, S, E> {
//
// default WStreamAction<K, S, E, WriteResult<K, S, E>> WriteEvents(Option<S> expectedSeq, Instant time,
// Iterable<E> events) {
// return new WStreamAction<K, S, E, WriteResult<K, S, E>>() {
// @Override public <X> X eval(Algebra<K, S, E, WriteResult<K, S, E>, X> interpreter) {
// return interpreter.Write(expectedSeq, time, events, TypeEq.refl());
// }
// };
// }
//
//
// default StreamAction.Factory<K, S, E> streamActionFactory() {
// return StreamAction.factory();
// }
//
// default <R> WStreamAction<K, S, E, R> ReadEventStream(Option<S> fromSeq,
// Fold<Event<K, S, E>, R> streamFold) {
// return streamActionFactory().ReadEventStream(fromSeq, streamFold)::eval;
// }
//
// default WStreamAction<K, S, E, Option<Event<K, S, E>>> GetLatestEvent() {
// return streamActionFactory().GetLatestEvent()::eval;
// }
//
// default <R> WStreamAction<K, S, E, R> Pure(R value) {
// return streamActionFactory().Pure(value)::eval;
// }
// }
//
// static <K, S, E> Factory<K, S, E> factory() {
// return new Factory<K, S, E>() {
// };
// }
//
// <X> X eval(Algebra<K, S, E, R, X> interpreter);
//
// default <Q> WStreamAction<K, S, E, Q> map(F<R, Q> f) {
// return bind(r -> WStreamAction.<K, S, E>factory().Pure(f.f(r))::eval);
// }
//
// default <Q> WStreamAction<K, S, E, Q> bind(F<R, WStreamAction<K, S, E, Q>> f) {
// return new WStreamAction<K, S, E, Q>() {
// @Override public <X> X eval(Algebra<K, S, E, Q, X> interpreter) {
// return interpreter.BindW(WStreamAction.this, f);
// }
// };
// }
// }
//
// Path: core/src/main/java/eventsrc4j/WriteResult.java
// @data
// @Derive({})
// public abstract class WriteResult<K, S, E> {
//
// WriteResult() {
// }
//
// public interface Cases<K, S, E, X> {
// X Success(List<Event<K, S, E>> events);
//
// X DuplicateEventSeq();
// }
//
// public abstract <X> X match(Cases<K, S, E, X> cases);
//
// public final Option<List<Event<K, S, E>>> events() {
// return getEvents(this);
// }
//
// @Override
// public abstract String toString();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract int hashCode();
//
// }
| import eventsrc4j.WStreamAction;
import eventsrc4j.WriteResult;
import fj.data.Option;
import java.time.Instant; | package eventsrc4j.io;
/**
* A stream of events, that can be read and written into.
*
* @param <K> events key type.
* @param <S> sequence used for ordering events in the stream.
* @param <E> concrete domain events type.
*/
public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
/**
* Save the given events at the end of the stream, if at expected sequence.
*
* @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
* expected to be empty.
* @param time timestamp of the events to save.
* @param events a list of events to save in the stream.
* @return an IO action producing the result of the write; either successful or indicating an
* optimistic concurrency error (duplicated sequence).
*/
IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
| // Path: core/src/main/java/eventsrc4j/WStreamAction.java
// @FunctionalInterface
// public interface WStreamAction<K, S, E, R> {
//
// /**
// * Monadic WStreamAction algebra, that is also a StreamAction algebra
// *
// * @param <R> action result type.
// * @param <X> interpreted action result type (eg. wrapped in a container).
// */
// interface Algebra<K, S, E, R, X> extends StreamAction.Algebra<K, S, E, R, X> {
//
// X Write(Option<S> expectedSeq, Instant time, Iterable<E> events, TypeEq<WriteResult<K, S, E>, R> resultType);
//
// <Q> X BindW(WStreamAction<K, S, E, Q> action, F<Q, WStreamAction<K, S, E, R>> function);
//
// // We derive implementation of monadic operations of the StreamAction algebra in term of this WStreamAction algebra:
// @Override
// default <Q> X Bind(StreamAction<K, S, E, Q> action,
// F<Q, StreamAction<K, S, E, R>> function) {
// return BindW(action::eval, compose(a -> a::eval, function));
// }
// }
//
// interface Factory<K, S, E> {
//
// default WStreamAction<K, S, E, WriteResult<K, S, E>> WriteEvents(Option<S> expectedSeq, Instant time,
// Iterable<E> events) {
// return new WStreamAction<K, S, E, WriteResult<K, S, E>>() {
// @Override public <X> X eval(Algebra<K, S, E, WriteResult<K, S, E>, X> interpreter) {
// return interpreter.Write(expectedSeq, time, events, TypeEq.refl());
// }
// };
// }
//
//
// default StreamAction.Factory<K, S, E> streamActionFactory() {
// return StreamAction.factory();
// }
//
// default <R> WStreamAction<K, S, E, R> ReadEventStream(Option<S> fromSeq,
// Fold<Event<K, S, E>, R> streamFold) {
// return streamActionFactory().ReadEventStream(fromSeq, streamFold)::eval;
// }
//
// default WStreamAction<K, S, E, Option<Event<K, S, E>>> GetLatestEvent() {
// return streamActionFactory().GetLatestEvent()::eval;
// }
//
// default <R> WStreamAction<K, S, E, R> Pure(R value) {
// return streamActionFactory().Pure(value)::eval;
// }
// }
//
// static <K, S, E> Factory<K, S, E> factory() {
// return new Factory<K, S, E>() {
// };
// }
//
// <X> X eval(Algebra<K, S, E, R, X> interpreter);
//
// default <Q> WStreamAction<K, S, E, Q> map(F<R, Q> f) {
// return bind(r -> WStreamAction.<K, S, E>factory().Pure(f.f(r))::eval);
// }
//
// default <Q> WStreamAction<K, S, E, Q> bind(F<R, WStreamAction<K, S, E, Q>> f) {
// return new WStreamAction<K, S, E, Q>() {
// @Override public <X> X eval(Algebra<K, S, E, Q, X> interpreter) {
// return interpreter.BindW(WStreamAction.this, f);
// }
// };
// }
// }
//
// Path: core/src/main/java/eventsrc4j/WriteResult.java
// @data
// @Derive({})
// public abstract class WriteResult<K, S, E> {
//
// WriteResult() {
// }
//
// public interface Cases<K, S, E, X> {
// X Success(List<Event<K, S, E>> events);
//
// X DuplicateEventSeq();
// }
//
// public abstract <X> X match(Cases<K, S, E, X> cases);
//
// public final Option<List<Event<K, S, E>>> events() {
// return getEvents(this);
// }
//
// @Override
// public abstract String toString();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract int hashCode();
//
// }
// Path: core/src/main/java/eventsrc4j/io/WritableEventStream.java
import eventsrc4j.WStreamAction;
import eventsrc4j.WriteResult;
import fj.data.Option;
import java.time.Instant;
package eventsrc4j.io;
/**
* A stream of events, that can be read and written into.
*
* @param <K> events key type.
* @param <S> sequence used for ordering events in the stream.
* @param <E> concrete domain events type.
*/
public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
/**
* Save the given events at the end of the stream, if at expected sequence.
*
* @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
* expected to be empty.
* @param time timestamp of the events to save.
* @param events a list of events to save in the stream.
* @return an IO action producing the result of the write; either successful or indicating an
* optimistic concurrency error (duplicated sequence).
*/
IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
| default <R> IO<R> evalWAction(WStreamAction<K, S, E, R> action) { |
jbgi/eventsrc4j | core/src/test/java/eventsrc4j/sample/person/PersonService.java | // Path: core/src/test/java/eventsrc4j/sample/person/PersonName.java
// public static Option<NameValue> parseName(String value) {
// return !value.trim().isEmpty()
// && !value.endsWith(" ")
// && !value.startsWith(" ")
// && value.length() <= 120
//
// ? some(NameValue0(value))
// : Option.<NameValue>none();
// }
| import fj.F;
import fj.Unit;
import fj.data.List;
import fj.data.NonEmptyList;
import fj.data.Option;
import fj.data.Validation;
import static eventsrc4j.sample.person.Addresses.Address;
import static eventsrc4j.sample.person.Addresses.modNumber;
import static eventsrc4j.sample.person.Contacts.getPostalAddress;
import static eventsrc4j.sample.person.Contacts.modPostalAddress;
import static eventsrc4j.sample.person.FirstNames.FirstName;
import static eventsrc4j.sample.person.LastNames.LastName;
import static eventsrc4j.sample.person.NameValues.NameValue0;
import static eventsrc4j.sample.person.PersonName.NameValue.parseName;
import static eventsrc4j.sample.person.PersonNames.PersonName;
import static eventsrc4j.sample.person.Persons.Person;
import static eventsrc4j.sample.person.Persons.getContact;
import static eventsrc4j.sample.person.Persons.modContact;
import static fj.Semigroup.nonEmptyListSemigroup;
import static fj.Unit.unit;
import static fj.data.Option.none;
import static fj.data.Option.some;
import static fj.data.Option.some_;
import static fj.data.Validation.success; | LastName(NameValue0("Black"))
),
Contacts.byMail(
Address(10, "Main St")
),
none()
));
}
private static Validation<NonEmptyList<String>, PersonName> validatePersonName(
String stringFirstName, Option<String> stringMiddleName, String stringLastName) {
return
// validate first name
validateName(stringFirstName, "First name").map(FirstNames::FirstName).nel()
.accumulate(nonEmptyListSemigroup(),
// validate middle name if present
stringMiddleName.map(s -> validateName(s, "Middle Name").map(MiddleNames::MiddleName).map(some_()))
.orSome(Validation.success(none())).nel(),
// validate last name
validateName(stringLastName, "Last name").map(LastNames::LastName).nel(),
// assemble all
PersonNames::PersonName
);
}
public static Validation<String, PersonName.NameValue> validateName(String name, String format) { | // Path: core/src/test/java/eventsrc4j/sample/person/PersonName.java
// public static Option<NameValue> parseName(String value) {
// return !value.trim().isEmpty()
// && !value.endsWith(" ")
// && !value.startsWith(" ")
// && value.length() <= 120
//
// ? some(NameValue0(value))
// : Option.<NameValue>none();
// }
// Path: core/src/test/java/eventsrc4j/sample/person/PersonService.java
import fj.F;
import fj.Unit;
import fj.data.List;
import fj.data.NonEmptyList;
import fj.data.Option;
import fj.data.Validation;
import static eventsrc4j.sample.person.Addresses.Address;
import static eventsrc4j.sample.person.Addresses.modNumber;
import static eventsrc4j.sample.person.Contacts.getPostalAddress;
import static eventsrc4j.sample.person.Contacts.modPostalAddress;
import static eventsrc4j.sample.person.FirstNames.FirstName;
import static eventsrc4j.sample.person.LastNames.LastName;
import static eventsrc4j.sample.person.NameValues.NameValue0;
import static eventsrc4j.sample.person.PersonName.NameValue.parseName;
import static eventsrc4j.sample.person.PersonNames.PersonName;
import static eventsrc4j.sample.person.Persons.Person;
import static eventsrc4j.sample.person.Persons.getContact;
import static eventsrc4j.sample.person.Persons.modContact;
import static fj.Semigroup.nonEmptyListSemigroup;
import static fj.Unit.unit;
import static fj.data.Option.none;
import static fj.data.Option.some;
import static fj.data.Option.some_;
import static fj.data.Validation.success;
LastName(NameValue0("Black"))
),
Contacts.byMail(
Address(10, "Main St")
),
none()
));
}
private static Validation<NonEmptyList<String>, PersonName> validatePersonName(
String stringFirstName, Option<String> stringMiddleName, String stringLastName) {
return
// validate first name
validateName(stringFirstName, "First name").map(FirstNames::FirstName).nel()
.accumulate(nonEmptyListSemigroup(),
// validate middle name if present
stringMiddleName.map(s -> validateName(s, "Middle Name").map(MiddleNames::MiddleName).map(some_()))
.orSome(Validation.success(none())).nel(),
// validate last name
validateName(stringLastName, "Last name").map(LastNames::LastName).nel(),
// assemble all
PersonNames::PersonName
);
}
public static Validation<String, PersonName.NameValue> validateName(String name, String format) { | return parseName(name).toValidation(format + " is not valid"); |
jbgi/eventsrc4j | core/src/main/java/eventsrc4j/io/SnapshotStream.java | // Path: core/src/main/java/eventsrc4j/SequenceQuery.java
// @data
// public abstract class SequenceQuery<S> {
// public interface Cases<S, R> {
// R Before(S s);
//
// R Earliest();
//
// R Latest();
// }
//
// SequenceQuery() {
// }
//
//
// public abstract <R> R match(Cases<S, R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
// }
//
// Path: core/src/main/java/eventsrc4j/Snapshot.java
// @data
// public abstract class Snapshot<S, V> {
//
// public interface Cases<S, V, R> {
//
// /**
// * Events have been saved and there is a value stored.
// *
// * @param seq the point in the stream that this Snapshot is for.
// * @param view the view on the stream upto to that point.
// */
// R Value(S seq, Instant time, V view);
//
// /**
// * There is no snapshot... i.e. no events have been saved.
// */
// R NoSnapshot();
//
// /**
// * Events have been saved and there is no value (i.e. the value has been deleted).
// *
// * @param seq Represents the point in the stream where the deletion occured.
// */
// R Deleted(S seq, Instant time);
// }
//
// Snapshot() {
// }
//
// public abstract <R> R match(Cases<S, V, R> cases);
//
// public final Option<S> seq() {
// return getSeq(this);
// }
//
// public final Option<Instant> time() {
// return getTime(this);
// }
//
// public final Option<V> view() {
// return getView(this);
// }
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// static final Equal<Instant> instantEqual = Equal.anyEqual();
// static final Hash<Instant> instantHash = Hash.anyHash();
// static final Show<Instant> instantShow = Show.anyShow();
// static final Ord<Instant> instantOrd = Ord.comparableOrd();
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotStoreMode.java
// @data
// public abstract class SnapshotStoreMode {
// SnapshotStoreMode(){}
//
// public interface Cases<R> {
// R Epoch();
// R Cache();
// }
//
// public abstract <R> R match(Cases<R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// }
| import eventsrc4j.SequenceQuery;
import eventsrc4j.Snapshot;
import eventsrc4j.SnapshotStoreMode; | package eventsrc4j.io;
/**
* Implementations of this interface deal with persisting snapshots for a specific key.
*
* @param <V> The type of the value wrapped by Snapshots that this store persists.
*/
public interface SnapshotStream<S, V> {
/**
* Retrieve a snapshot before the given sequence number. We typically specify a sequence number if we want to get
* some old snapshot i.e. the latest persisted snapshot may have been generated after the point in time that we're
* interested in.
*
* @param sequence What sequence we want to get the snapshot for (earliest snapshot, latest, or latest before some sequence)
* @return The snapshot, a NoSnapshot if there was no snapshot for the given conditions.
*/
IO<Snapshot<S, V>> get(SequenceQuery<S> sequence);
/**
* Save a given snapshot
* @param snapshot The snapshot to save
* @param mode Defines whether the given snapshot should be deemed the earliest point in the event stream (Epoch) or not (Cache)
* @return the saved snapshot.
*/ | // Path: core/src/main/java/eventsrc4j/SequenceQuery.java
// @data
// public abstract class SequenceQuery<S> {
// public interface Cases<S, R> {
// R Before(S s);
//
// R Earliest();
//
// R Latest();
// }
//
// SequenceQuery() {
// }
//
//
// public abstract <R> R match(Cases<S, R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
// }
//
// Path: core/src/main/java/eventsrc4j/Snapshot.java
// @data
// public abstract class Snapshot<S, V> {
//
// public interface Cases<S, V, R> {
//
// /**
// * Events have been saved and there is a value stored.
// *
// * @param seq the point in the stream that this Snapshot is for.
// * @param view the view on the stream upto to that point.
// */
// R Value(S seq, Instant time, V view);
//
// /**
// * There is no snapshot... i.e. no events have been saved.
// */
// R NoSnapshot();
//
// /**
// * Events have been saved and there is no value (i.e. the value has been deleted).
// *
// * @param seq Represents the point in the stream where the deletion occured.
// */
// R Deleted(S seq, Instant time);
// }
//
// Snapshot() {
// }
//
// public abstract <R> R match(Cases<S, V, R> cases);
//
// public final Option<S> seq() {
// return getSeq(this);
// }
//
// public final Option<Instant> time() {
// return getTime(this);
// }
//
// public final Option<V> view() {
// return getView(this);
// }
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// static final Equal<Instant> instantEqual = Equal.anyEqual();
// static final Hash<Instant> instantHash = Hash.anyHash();
// static final Show<Instant> instantShow = Show.anyShow();
// static final Ord<Instant> instantOrd = Ord.comparableOrd();
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotStoreMode.java
// @data
// public abstract class SnapshotStoreMode {
// SnapshotStoreMode(){}
//
// public interface Cases<R> {
// R Epoch();
// R Cache();
// }
//
// public abstract <R> R match(Cases<R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// }
// Path: core/src/main/java/eventsrc4j/io/SnapshotStream.java
import eventsrc4j.SequenceQuery;
import eventsrc4j.Snapshot;
import eventsrc4j.SnapshotStoreMode;
package eventsrc4j.io;
/**
* Implementations of this interface deal with persisting snapshots for a specific key.
*
* @param <V> The type of the value wrapped by Snapshots that this store persists.
*/
public interface SnapshotStream<S, V> {
/**
* Retrieve a snapshot before the given sequence number. We typically specify a sequence number if we want to get
* some old snapshot i.e. the latest persisted snapshot may have been generated after the point in time that we're
* interested in.
*
* @param sequence What sequence we want to get the snapshot for (earliest snapshot, latest, or latest before some sequence)
* @return The snapshot, a NoSnapshot if there was no snapshot for the given conditions.
*/
IO<Snapshot<S, V>> get(SequenceQuery<S> sequence);
/**
* Save a given snapshot
* @param snapshot The snapshot to save
* @param mode Defines whether the given snapshot should be deemed the earliest point in the event stream (Epoch) or not (Cache)
* @return the saved snapshot.
*/ | IO<Snapshot<S, V>> put(Snapshot<S, V> snapshot, SnapshotStoreMode mode); |
jbgi/eventsrc4j | core/src/main/java/eventsrc4j/io/SnapshotIOAlgebra.java | // Path: core/src/main/java/eventsrc4j/SequenceQuery.java
// @data
// public abstract class SequenceQuery<S> {
// public interface Cases<S, R> {
// R Before(S s);
//
// R Earliest();
//
// R Latest();
// }
//
// SequenceQuery() {
// }
//
//
// public abstract <R> R match(Cases<S, R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
// }
//
// Path: core/src/main/java/eventsrc4j/Snapshot.java
// @data
// public abstract class Snapshot<S, V> {
//
// public interface Cases<S, V, R> {
//
// /**
// * Events have been saved and there is a value stored.
// *
// * @param seq the point in the stream that this Snapshot is for.
// * @param view the view on the stream upto to that point.
// */
// R Value(S seq, Instant time, V view);
//
// /**
// * There is no snapshot... i.e. no events have been saved.
// */
// R NoSnapshot();
//
// /**
// * Events have been saved and there is no value (i.e. the value has been deleted).
// *
// * @param seq Represents the point in the stream where the deletion occured.
// */
// R Deleted(S seq, Instant time);
// }
//
// Snapshot() {
// }
//
// public abstract <R> R match(Cases<S, V, R> cases);
//
// public final Option<S> seq() {
// return getSeq(this);
// }
//
// public final Option<Instant> time() {
// return getTime(this);
// }
//
// public final Option<V> view() {
// return getView(this);
// }
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// static final Equal<Instant> instantEqual = Equal.anyEqual();
// static final Hash<Instant> instantHash = Hash.anyHash();
// static final Show<Instant> instantShow = Show.anyShow();
// static final Ord<Instant> instantOrd = Ord.comparableOrd();
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotAction.java
// @FunctionalInterface
// public interface SnapshotAction<S, V, R> {
//
// /**
// * Monadic SnapshotAction algebra.
// *
// * @param <R> action result type.
// * @param <X> interpreted action result type (eg. wrapped in a container).
// */
// interface Algebra<S, V, R, X> extends Pure<R, X> {
//
// X Get(SequenceQuery<S> sequence, TypeEq<Snapshot<S, V>, R> resultType);
//
// X Put(Snapshot<S, V> snapshot, SnapshotStoreMode mode, TypeEq<Snapshot<S, V>, R> resultType);
//
// <Q> X Bind(SnapshotAction<S, V, Q> action, F<Q, SnapshotAction<S, V, R>> function);
// }
//
// static <S, V> Factory<S, V> factory() {
// return new Factory<S, V>() {};
// }
//
// interface Factory<S, V> {
//
// default SnapshotAction<S, V, Snapshot<S, V>> GetSnapshot(SequenceQuery<S> sequence) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Get(sequence, TypeEq.refl());
// }
// };
// }
//
// default SnapshotAction<S, V, Snapshot<S, V>> PutSnapshot(Snapshot<S, V> snapshot, SnapshotStoreMode mode) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Put(snapshot, mode, TypeEq.refl());
// }
// };
// }
//
// default <R> SnapshotAction<S, V, R> PureSnapshotAction(R value) {
// return new SnapshotAction<S, V, R>() {
// @Override public <X> X eval(Algebra<S, V, R, X> interpreter) {
// return interpreter.Pure(value);
// }
// };
// }
// }
//
//
// default <Q> SnapshotAction<S, V, Q> bind(F<R, SnapshotAction<S, V, Q>> f) {
// return new SnapshotAction<S, V, Q>() {
// @Override public <X> X eval(Algebra<S, V, Q, X> interpreter) {
// return interpreter.Bind(SnapshotAction.this, f);
// }
// };
// }
//
// default <Q> SnapshotAction<S, V, Q> map(F<R, Q> f) {
// return bind(r -> SnapshotAction.<S, V>factory().PureSnapshotAction(f.f(r)));
// }
//
//
// <X> X eval(SnapshotAction.Algebra<S, V, R, X> interpreter);
//
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotStoreMode.java
// @data
// public abstract class SnapshotStoreMode {
// SnapshotStoreMode(){}
//
// public interface Cases<R> {
// R Epoch();
// R Cache();
// }
//
// public abstract <R> R match(Cases<R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// }
| import eventsrc4j.SequenceQuery;
import eventsrc4j.Snapshot;
import eventsrc4j.SnapshotAction;
import eventsrc4j.SnapshotStoreMode;
import fj.F;
import org.derive4j.hkt.TypeEq; | package eventsrc4j.io;
public interface SnapshotIOAlgebra<S, V, R> extends PureIO<R>, SnapshotAction.Algebra<S, V, R, IO<R>> {
static <S, V, R> SnapshotIOAlgebra<S, V, R> of(SnapshotStream<S, V> eventStream) {
return new SnapshotIOAlgebra<S, V, R>() {
| // Path: core/src/main/java/eventsrc4j/SequenceQuery.java
// @data
// public abstract class SequenceQuery<S> {
// public interface Cases<S, R> {
// R Before(S s);
//
// R Earliest();
//
// R Latest();
// }
//
// SequenceQuery() {
// }
//
//
// public abstract <R> R match(Cases<S, R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
// }
//
// Path: core/src/main/java/eventsrc4j/Snapshot.java
// @data
// public abstract class Snapshot<S, V> {
//
// public interface Cases<S, V, R> {
//
// /**
// * Events have been saved and there is a value stored.
// *
// * @param seq the point in the stream that this Snapshot is for.
// * @param view the view on the stream upto to that point.
// */
// R Value(S seq, Instant time, V view);
//
// /**
// * There is no snapshot... i.e. no events have been saved.
// */
// R NoSnapshot();
//
// /**
// * Events have been saved and there is no value (i.e. the value has been deleted).
// *
// * @param seq Represents the point in the stream where the deletion occured.
// */
// R Deleted(S seq, Instant time);
// }
//
// Snapshot() {
// }
//
// public abstract <R> R match(Cases<S, V, R> cases);
//
// public final Option<S> seq() {
// return getSeq(this);
// }
//
// public final Option<Instant> time() {
// return getTime(this);
// }
//
// public final Option<V> view() {
// return getView(this);
// }
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// static final Equal<Instant> instantEqual = Equal.anyEqual();
// static final Hash<Instant> instantHash = Hash.anyHash();
// static final Show<Instant> instantShow = Show.anyShow();
// static final Ord<Instant> instantOrd = Ord.comparableOrd();
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotAction.java
// @FunctionalInterface
// public interface SnapshotAction<S, V, R> {
//
// /**
// * Monadic SnapshotAction algebra.
// *
// * @param <R> action result type.
// * @param <X> interpreted action result type (eg. wrapped in a container).
// */
// interface Algebra<S, V, R, X> extends Pure<R, X> {
//
// X Get(SequenceQuery<S> sequence, TypeEq<Snapshot<S, V>, R> resultType);
//
// X Put(Snapshot<S, V> snapshot, SnapshotStoreMode mode, TypeEq<Snapshot<S, V>, R> resultType);
//
// <Q> X Bind(SnapshotAction<S, V, Q> action, F<Q, SnapshotAction<S, V, R>> function);
// }
//
// static <S, V> Factory<S, V> factory() {
// return new Factory<S, V>() {};
// }
//
// interface Factory<S, V> {
//
// default SnapshotAction<S, V, Snapshot<S, V>> GetSnapshot(SequenceQuery<S> sequence) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Get(sequence, TypeEq.refl());
// }
// };
// }
//
// default SnapshotAction<S, V, Snapshot<S, V>> PutSnapshot(Snapshot<S, V> snapshot, SnapshotStoreMode mode) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Put(snapshot, mode, TypeEq.refl());
// }
// };
// }
//
// default <R> SnapshotAction<S, V, R> PureSnapshotAction(R value) {
// return new SnapshotAction<S, V, R>() {
// @Override public <X> X eval(Algebra<S, V, R, X> interpreter) {
// return interpreter.Pure(value);
// }
// };
// }
// }
//
//
// default <Q> SnapshotAction<S, V, Q> bind(F<R, SnapshotAction<S, V, Q>> f) {
// return new SnapshotAction<S, V, Q>() {
// @Override public <X> X eval(Algebra<S, V, Q, X> interpreter) {
// return interpreter.Bind(SnapshotAction.this, f);
// }
// };
// }
//
// default <Q> SnapshotAction<S, V, Q> map(F<R, Q> f) {
// return bind(r -> SnapshotAction.<S, V>factory().PureSnapshotAction(f.f(r)));
// }
//
//
// <X> X eval(SnapshotAction.Algebra<S, V, R, X> interpreter);
//
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotStoreMode.java
// @data
// public abstract class SnapshotStoreMode {
// SnapshotStoreMode(){}
//
// public interface Cases<R> {
// R Epoch();
// R Cache();
// }
//
// public abstract <R> R match(Cases<R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// }
// Path: core/src/main/java/eventsrc4j/io/SnapshotIOAlgebra.java
import eventsrc4j.SequenceQuery;
import eventsrc4j.Snapshot;
import eventsrc4j.SnapshotAction;
import eventsrc4j.SnapshotStoreMode;
import fj.F;
import org.derive4j.hkt.TypeEq;
package eventsrc4j.io;
public interface SnapshotIOAlgebra<S, V, R> extends PureIO<R>, SnapshotAction.Algebra<S, V, R, IO<R>> {
static <S, V, R> SnapshotIOAlgebra<S, V, R> of(SnapshotStream<S, V> eventStream) {
return new SnapshotIOAlgebra<S, V, R>() {
| @Override public IO<R> Get(SequenceQuery<S> sequence, TypeEq<Snapshot<S, V>, R> resultType) { |
jbgi/eventsrc4j | core/src/main/java/eventsrc4j/io/SnapshotIOAlgebra.java | // Path: core/src/main/java/eventsrc4j/SequenceQuery.java
// @data
// public abstract class SequenceQuery<S> {
// public interface Cases<S, R> {
// R Before(S s);
//
// R Earliest();
//
// R Latest();
// }
//
// SequenceQuery() {
// }
//
//
// public abstract <R> R match(Cases<S, R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
// }
//
// Path: core/src/main/java/eventsrc4j/Snapshot.java
// @data
// public abstract class Snapshot<S, V> {
//
// public interface Cases<S, V, R> {
//
// /**
// * Events have been saved and there is a value stored.
// *
// * @param seq the point in the stream that this Snapshot is for.
// * @param view the view on the stream upto to that point.
// */
// R Value(S seq, Instant time, V view);
//
// /**
// * There is no snapshot... i.e. no events have been saved.
// */
// R NoSnapshot();
//
// /**
// * Events have been saved and there is no value (i.e. the value has been deleted).
// *
// * @param seq Represents the point in the stream where the deletion occured.
// */
// R Deleted(S seq, Instant time);
// }
//
// Snapshot() {
// }
//
// public abstract <R> R match(Cases<S, V, R> cases);
//
// public final Option<S> seq() {
// return getSeq(this);
// }
//
// public final Option<Instant> time() {
// return getTime(this);
// }
//
// public final Option<V> view() {
// return getView(this);
// }
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// static final Equal<Instant> instantEqual = Equal.anyEqual();
// static final Hash<Instant> instantHash = Hash.anyHash();
// static final Show<Instant> instantShow = Show.anyShow();
// static final Ord<Instant> instantOrd = Ord.comparableOrd();
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotAction.java
// @FunctionalInterface
// public interface SnapshotAction<S, V, R> {
//
// /**
// * Monadic SnapshotAction algebra.
// *
// * @param <R> action result type.
// * @param <X> interpreted action result type (eg. wrapped in a container).
// */
// interface Algebra<S, V, R, X> extends Pure<R, X> {
//
// X Get(SequenceQuery<S> sequence, TypeEq<Snapshot<S, V>, R> resultType);
//
// X Put(Snapshot<S, V> snapshot, SnapshotStoreMode mode, TypeEq<Snapshot<S, V>, R> resultType);
//
// <Q> X Bind(SnapshotAction<S, V, Q> action, F<Q, SnapshotAction<S, V, R>> function);
// }
//
// static <S, V> Factory<S, V> factory() {
// return new Factory<S, V>() {};
// }
//
// interface Factory<S, V> {
//
// default SnapshotAction<S, V, Snapshot<S, V>> GetSnapshot(SequenceQuery<S> sequence) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Get(sequence, TypeEq.refl());
// }
// };
// }
//
// default SnapshotAction<S, V, Snapshot<S, V>> PutSnapshot(Snapshot<S, V> snapshot, SnapshotStoreMode mode) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Put(snapshot, mode, TypeEq.refl());
// }
// };
// }
//
// default <R> SnapshotAction<S, V, R> PureSnapshotAction(R value) {
// return new SnapshotAction<S, V, R>() {
// @Override public <X> X eval(Algebra<S, V, R, X> interpreter) {
// return interpreter.Pure(value);
// }
// };
// }
// }
//
//
// default <Q> SnapshotAction<S, V, Q> bind(F<R, SnapshotAction<S, V, Q>> f) {
// return new SnapshotAction<S, V, Q>() {
// @Override public <X> X eval(Algebra<S, V, Q, X> interpreter) {
// return interpreter.Bind(SnapshotAction.this, f);
// }
// };
// }
//
// default <Q> SnapshotAction<S, V, Q> map(F<R, Q> f) {
// return bind(r -> SnapshotAction.<S, V>factory().PureSnapshotAction(f.f(r)));
// }
//
//
// <X> X eval(SnapshotAction.Algebra<S, V, R, X> interpreter);
//
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotStoreMode.java
// @data
// public abstract class SnapshotStoreMode {
// SnapshotStoreMode(){}
//
// public interface Cases<R> {
// R Epoch();
// R Cache();
// }
//
// public abstract <R> R match(Cases<R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// }
| import eventsrc4j.SequenceQuery;
import eventsrc4j.Snapshot;
import eventsrc4j.SnapshotAction;
import eventsrc4j.SnapshotStoreMode;
import fj.F;
import org.derive4j.hkt.TypeEq; | package eventsrc4j.io;
public interface SnapshotIOAlgebra<S, V, R> extends PureIO<R>, SnapshotAction.Algebra<S, V, R, IO<R>> {
static <S, V, R> SnapshotIOAlgebra<S, V, R> of(SnapshotStream<S, V> eventStream) {
return new SnapshotIOAlgebra<S, V, R>() {
| // Path: core/src/main/java/eventsrc4j/SequenceQuery.java
// @data
// public abstract class SequenceQuery<S> {
// public interface Cases<S, R> {
// R Before(S s);
//
// R Earliest();
//
// R Latest();
// }
//
// SequenceQuery() {
// }
//
//
// public abstract <R> R match(Cases<S, R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
// }
//
// Path: core/src/main/java/eventsrc4j/Snapshot.java
// @data
// public abstract class Snapshot<S, V> {
//
// public interface Cases<S, V, R> {
//
// /**
// * Events have been saved and there is a value stored.
// *
// * @param seq the point in the stream that this Snapshot is for.
// * @param view the view on the stream upto to that point.
// */
// R Value(S seq, Instant time, V view);
//
// /**
// * There is no snapshot... i.e. no events have been saved.
// */
// R NoSnapshot();
//
// /**
// * Events have been saved and there is no value (i.e. the value has been deleted).
// *
// * @param seq Represents the point in the stream where the deletion occured.
// */
// R Deleted(S seq, Instant time);
// }
//
// Snapshot() {
// }
//
// public abstract <R> R match(Cases<S, V, R> cases);
//
// public final Option<S> seq() {
// return getSeq(this);
// }
//
// public final Option<Instant> time() {
// return getTime(this);
// }
//
// public final Option<V> view() {
// return getView(this);
// }
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// static final Equal<Instant> instantEqual = Equal.anyEqual();
// static final Hash<Instant> instantHash = Hash.anyHash();
// static final Show<Instant> instantShow = Show.anyShow();
// static final Ord<Instant> instantOrd = Ord.comparableOrd();
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotAction.java
// @FunctionalInterface
// public interface SnapshotAction<S, V, R> {
//
// /**
// * Monadic SnapshotAction algebra.
// *
// * @param <R> action result type.
// * @param <X> interpreted action result type (eg. wrapped in a container).
// */
// interface Algebra<S, V, R, X> extends Pure<R, X> {
//
// X Get(SequenceQuery<S> sequence, TypeEq<Snapshot<S, V>, R> resultType);
//
// X Put(Snapshot<S, V> snapshot, SnapshotStoreMode mode, TypeEq<Snapshot<S, V>, R> resultType);
//
// <Q> X Bind(SnapshotAction<S, V, Q> action, F<Q, SnapshotAction<S, V, R>> function);
// }
//
// static <S, V> Factory<S, V> factory() {
// return new Factory<S, V>() {};
// }
//
// interface Factory<S, V> {
//
// default SnapshotAction<S, V, Snapshot<S, V>> GetSnapshot(SequenceQuery<S> sequence) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Get(sequence, TypeEq.refl());
// }
// };
// }
//
// default SnapshotAction<S, V, Snapshot<S, V>> PutSnapshot(Snapshot<S, V> snapshot, SnapshotStoreMode mode) {
// return new SnapshotAction<S, V, Snapshot<S, V>>() {
// @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
// return interpreter.Put(snapshot, mode, TypeEq.refl());
// }
// };
// }
//
// default <R> SnapshotAction<S, V, R> PureSnapshotAction(R value) {
// return new SnapshotAction<S, V, R>() {
// @Override public <X> X eval(Algebra<S, V, R, X> interpreter) {
// return interpreter.Pure(value);
// }
// };
// }
// }
//
//
// default <Q> SnapshotAction<S, V, Q> bind(F<R, SnapshotAction<S, V, Q>> f) {
// return new SnapshotAction<S, V, Q>() {
// @Override public <X> X eval(Algebra<S, V, Q, X> interpreter) {
// return interpreter.Bind(SnapshotAction.this, f);
// }
// };
// }
//
// default <Q> SnapshotAction<S, V, Q> map(F<R, Q> f) {
// return bind(r -> SnapshotAction.<S, V>factory().PureSnapshotAction(f.f(r)));
// }
//
//
// <X> X eval(SnapshotAction.Algebra<S, V, R, X> interpreter);
//
// }
//
// Path: core/src/main/java/eventsrc4j/SnapshotStoreMode.java
// @data
// public abstract class SnapshotStoreMode {
// SnapshotStoreMode(){}
//
// public interface Cases<R> {
// R Epoch();
// R Cache();
// }
//
// public abstract <R> R match(Cases<R> cases);
//
// @Override
// public abstract int hashCode();
//
// @Override
// public abstract boolean equals(Object obj);
//
// @Override
// public abstract String toString();
//
// }
// Path: core/src/main/java/eventsrc4j/io/SnapshotIOAlgebra.java
import eventsrc4j.SequenceQuery;
import eventsrc4j.Snapshot;
import eventsrc4j.SnapshotAction;
import eventsrc4j.SnapshotStoreMode;
import fj.F;
import org.derive4j.hkt.TypeEq;
package eventsrc4j.io;
public interface SnapshotIOAlgebra<S, V, R> extends PureIO<R>, SnapshotAction.Algebra<S, V, R, IO<R>> {
static <S, V, R> SnapshotIOAlgebra<S, V, R> of(SnapshotStream<S, V> eventStream) {
return new SnapshotIOAlgebra<S, V, R>() {
| @Override public IO<R> Get(SequenceQuery<S> sequence, TypeEq<Snapshot<S, V>, R> resultType) { |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/preferences/PreferenceConstants.java | // Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// /**
// * The plug-in ID.
// */
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.ui";
//
// /**
// * The shared instance.
// */
// private static Activator plugin;
//
// /**
// * The constructor.
// */
// public Activator() {
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
// * @generated
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
// * @generated
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance.
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
//
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
| import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.ui.Activator; | public static final String GENERATION_JAVA_2_SOLIDITY_TYPES = "GENERATION_JAVA_2_SOLIDITY_TYPES";
public static final String GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX = "GENERATION_JAVA_2_SOLIDITY_TYPE_";
public static final String GENERATE_JAVA_TESTS = "GENERATE_JAVA_TESTS";
public static final String GENERATION_JAVA_TEST_TARGET = "GENERATION_JAVA_TEST_TARGET";
public static final String GENERATE_WEB3 = "GENERATE_WEB3";
public static final String GENERATE_HTML = "GENERATE_HTML";
public static final String GENERATE_MIX = "GENERATE_MIX";
public static final String GENERATE_MARKDOWN = "GENERATE_MARKDOWN";
public static final String JS_FILE_HEADER = "JS_FILE_HEADER";
public static final String GENERATE_JS_CONTROLLER = "GENERATE_JS_CONTROLLER";
public static final String GENERATE_JS_CONTROLLER_TARGET = "GENERATE_JS_CONTROLLER_TARGET";
public static final String GENERATE_JS_TEST = "GENERATE_JS_TEST";
public static final String GENERATE_JS_TEST_TARGET = "GENERATE_JS_TEST_TARGET";
public static final String GENERATE_ABI_TARGET = "GENERATE_ABI_TARGET";
public static final String GENERATE_ABI = "GENERATE_ABI";
public static final String GENERATOR_PROJECT_SETTINGS = "COMPILE_CONTRACTS_PROJECT_SETTINGS";
public static final String CONTRACT_FILE_HEADER = "CONTRACT_FILE_HEADER";
public static final String VERSION_PRAGMA = "version_pragma";
public static final String ENABLE_VERSION = "enable_version";
public static final String GENERATE_JAVA_NONBLOCKING = "GENERATE_JAVA_NONBLOCKING";
public static IPreferenceStore getPreferenceStore(IProject project) {
if (project != null) { | // Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// /**
// * The plug-in ID.
// */
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.ui";
//
// /**
// * The shared instance.
// */
// private static Activator plugin;
//
// /**
// * The constructor.
// */
// public Activator() {
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
// * @generated
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
// * @generated
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance.
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
//
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
// Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/preferences/PreferenceConstants.java
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.ui.Activator;
public static final String GENERATION_JAVA_2_SOLIDITY_TYPES = "GENERATION_JAVA_2_SOLIDITY_TYPES";
public static final String GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX = "GENERATION_JAVA_2_SOLIDITY_TYPE_";
public static final String GENERATE_JAVA_TESTS = "GENERATE_JAVA_TESTS";
public static final String GENERATION_JAVA_TEST_TARGET = "GENERATION_JAVA_TEST_TARGET";
public static final String GENERATE_WEB3 = "GENERATE_WEB3";
public static final String GENERATE_HTML = "GENERATE_HTML";
public static final String GENERATE_MIX = "GENERATE_MIX";
public static final String GENERATE_MARKDOWN = "GENERATE_MARKDOWN";
public static final String JS_FILE_HEADER = "JS_FILE_HEADER";
public static final String GENERATE_JS_CONTROLLER = "GENERATE_JS_CONTROLLER";
public static final String GENERATE_JS_CONTROLLER_TARGET = "GENERATE_JS_CONTROLLER_TARGET";
public static final String GENERATE_JS_TEST = "GENERATE_JS_TEST";
public static final String GENERATE_JS_TEST_TARGET = "GENERATE_JS_TEST_TARGET";
public static final String GENERATE_ABI_TARGET = "GENERATE_ABI_TARGET";
public static final String GENERATE_ABI = "GENERATE_ABI";
public static final String GENERATOR_PROJECT_SETTINGS = "COMPILE_CONTRACTS_PROJECT_SETTINGS";
public static final String CONTRACT_FILE_HEADER = "CONTRACT_FILE_HEADER";
public static final String VERSION_PRAGMA = "version_pragma";
public static final String ENABLE_VERSION = "enable_version";
public static final String GENERATE_JAVA_NONBLOCKING = "GENERATE_JAVA_NONBLOCKING";
public static IPreferenceStore getPreferenceStore(IProject project) {
if (project != null) { | IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID); |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/SolcBuilderPreferencePage.java | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
//
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/PreferenceConstants.java
// public static class SolC{
// String name;
// String path;
// String version;
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((name == null) ? 0 : name.hashCode());
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// result = prime * result + ((version == null) ? 0 : version.hashCode());
// return result;
// }
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SolC other = (SolC) obj;
// if (name == null) {
// if (other.name != null)
// return false;
// } else if (!name.equals(other.name))
// return false;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// if (version == null) {
// if (other.version != null)
// return false;
// } else if (!version.equals(other.version))
// return false;
// return true;
// }
// }
| import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringButtonFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.compiler.support.Activator;
import de.urszeidler.eclipse.solidity.compiler.support.preferences.PreferenceConstants.SolC; | getFieldEditorParent()) {
@Override
protected String changePressed() {
Path srcDir = new Path(getStringValue());
IResource member = project.findMember(srcDir);
if (member == null)
member = ResourcesPlugin.getWorkspace().getRoot().findMember(srcDir);
ContainerSelectionDialog containerSelectionDialog = new ContainerSelectionDialog(getShell(),
(IContainer) member, false, "select dirctory of the source files");
containerSelectionDialog.open();
Object[] result = containerSelectionDialog.getResult();
if (result != null && result.length == 1) {
IPath container = (IPath) result[0];
compilerTarget.setStringValue(container.toString() + "/combined.json");
return container.toString();
}
return null;
}
};
sourceDirectory.setEmptyStringAllowed(false);
addField(sourceDirectory);
}
compilerTarget = new StringFieldEditor(PreferenceConstants.COMPILER_TARGET_COMBINE_ABI, "compile to file", -1,
StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
addField(compilerTarget);
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, preferencesId()); | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
//
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/PreferenceConstants.java
// public static class SolC{
// String name;
// String path;
// String version;
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((name == null) ? 0 : name.hashCode());
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// result = prime * result + ((version == null) ? 0 : version.hashCode());
// return result;
// }
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SolC other = (SolC) obj;
// if (name == null) {
// if (other.name != null)
// return false;
// } else if (!name.equals(other.name))
// return false;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// if (version == null) {
// if (other.version != null)
// return false;
// } else if (!version.equals(other.version))
// return false;
// return true;
// }
// }
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/SolcBuilderPreferencePage.java
import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringButtonFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.compiler.support.Activator;
import de.urszeidler.eclipse.solidity.compiler.support.preferences.PreferenceConstants.SolC;
getFieldEditorParent()) {
@Override
protected String changePressed() {
Path srcDir = new Path(getStringValue());
IResource member = project.findMember(srcDir);
if (member == null)
member = ResourcesPlugin.getWorkspace().getRoot().findMember(srcDir);
ContainerSelectionDialog containerSelectionDialog = new ContainerSelectionDialog(getShell(),
(IContainer) member, false, "select dirctory of the source files");
containerSelectionDialog.open();
Object[] result = containerSelectionDialog.getResult();
if (result != null && result.length == 1) {
IPath container = (IPath) result[0];
compilerTarget.setStringValue(container.toString() + "/combined.json");
return container.toString();
}
return null;
}
};
sourceDirectory.setEmptyStringAllowed(false);
addField(sourceDirectory);
}
compilerTarget = new StringFieldEditor(PreferenceConstants.COMPILER_TARGET_COMBINE_ABI, "compile to file", -1,
StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
addField(compilerTarget);
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, preferencesId()); | final List<SolC> parsePreferences = PreferenceConstants |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/SolcBuilderPreferencePage.java | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
//
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/PreferenceConstants.java
// public static class SolC{
// String name;
// String path;
// String version;
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((name == null) ? 0 : name.hashCode());
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// result = prime * result + ((version == null) ? 0 : version.hashCode());
// return result;
// }
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SolC other = (SolC) obj;
// if (name == null) {
// if (other.name != null)
// return false;
// } else if (!name.equals(other.name))
// return false;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// if (version == null) {
// if (other.version != null)
// return false;
// } else if (!version.equals(other.version))
// return false;
// return true;
// }
// }
| import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringButtonFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.compiler.support.Activator;
import de.urszeidler.eclipse.solidity.compiler.support.preferences.PreferenceConstants.SolC; | setDescription(
"The project solidity builder preferences. "
+ "The builder compiles to a combine json format. "
+ "All *.sol files of the source directory are selected. Add/remove the builder via configure project.");
}else
setDescription(
"The solidity builder preferences. "
+ "The builder compiles to a combine json format. When selected for a project. "
+ "All *.sol files of the source directory are selected. Add/remove the builder via configure project.");
super.createControl(parent);
}
@Override
protected void checkState() {
super.checkState();
validateInput();
}
/**
* Initialize the preference page.
*/
public void init(IWorkbench workbench) {
// Initialize the preference page
}
@Override
protected String preferencesId() { | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
//
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/PreferenceConstants.java
// public static class SolC{
// String name;
// String path;
// String version;
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((name == null) ? 0 : name.hashCode());
// result = prime * result + ((path == null) ? 0 : path.hashCode());
// result = prime * result + ((version == null) ? 0 : version.hashCode());
// return result;
// }
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SolC other = (SolC) obj;
// if (name == null) {
// if (other.name != null)
// return false;
// } else if (!name.equals(other.name))
// return false;
// if (path == null) {
// if (other.path != null)
// return false;
// } else if (!path.equals(other.path))
// return false;
// if (version == null) {
// if (other.version != null)
// return false;
// } else if (!version.equals(other.version))
// return false;
// return true;
// }
// }
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/SolcBuilderPreferencePage.java
import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringButtonFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.compiler.support.Activator;
import de.urszeidler.eclipse.solidity.compiler.support.preferences.PreferenceConstants.SolC;
setDescription(
"The project solidity builder preferences. "
+ "The builder compiles to a combine json format. "
+ "All *.sol files of the source directory are selected. Add/remove the builder via configure project.");
}else
setDescription(
"The solidity builder preferences. "
+ "The builder compiles to a combine json format. When selected for a project. "
+ "All *.sol files of the source directory are selected. Add/remove the builder via configure project.");
super.createControl(parent);
}
@Override
protected void checkState() {
super.checkState();
validateInput();
}
/**
* Initialize the preference page.
*/
public void init(IWorkbench workbench) {
// Initialize the preference page
}
@Override
protected String preferencesId() { | return Activator.PLUGIN_ID; |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/util/Uml2Service.java | // Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/preferences/PreferenceConstants.java
// public class PreferenceConstants {
//
// public static final String GENERATE_CONTRACT_FILES = "GENERATE_CONTRACT_FILES";
// public static final String GENERATION_TARGET = "GENERATION_TARGET";
// public static final String GENERATION_TARGET_DOC = "GENERATION_TARGET_DOC";
// public static final String GENERATION_ALL_IN_ONE_FILE = "GENERATION_ALL_IN_ONE_FILE";
//
// public static final String GENERATE_JAVA_INTERFACE = "GENERATE_JAVA_INTERFACE";
// public static final String GENERATION_JAVA_INTERFACE_TARGET = "GENERATION_JAVA_INTERFACE_TARGET";
// public static final String GENERATION_JAVA_INTERFACE_PACKAGE_PREFIX = "GENERATION_JAVA_INTERFACE_PACKAGE_PREFIX";
// public static final String GENERATION_JAVA_2_SOLIDITY_TYPES = "GENERATION_JAVA_2_SOLIDITY_TYPES";
// public static final String GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX = "GENERATION_JAVA_2_SOLIDITY_TYPE_";
// public static final String GENERATE_JAVA_TESTS = "GENERATE_JAVA_TESTS";
// public static final String GENERATION_JAVA_TEST_TARGET = "GENERATION_JAVA_TEST_TARGET";
//
//
// public static final String GENERATE_WEB3 = "GENERATE_WEB3";
// public static final String GENERATE_HTML = "GENERATE_HTML";
// public static final String GENERATE_MIX = "GENERATE_MIX";
// public static final String GENERATE_MARKDOWN = "GENERATE_MARKDOWN";
//
// public static final String JS_FILE_HEADER = "JS_FILE_HEADER";
// public static final String GENERATE_JS_CONTROLLER = "GENERATE_JS_CONTROLLER";
// public static final String GENERATE_JS_CONTROLLER_TARGET = "GENERATE_JS_CONTROLLER_TARGET";
// public static final String GENERATE_JS_TEST = "GENERATE_JS_TEST";
// public static final String GENERATE_JS_TEST_TARGET = "GENERATE_JS_TEST_TARGET";
// public static final String GENERATE_ABI_TARGET = "GENERATE_ABI_TARGET";
// public static final String GENERATE_ABI = "GENERATE_ABI";
//
// public static final String GENERATOR_PROJECT_SETTINGS = "COMPILE_CONTRACTS_PROJECT_SETTINGS";
// public static final String CONTRACT_FILE_HEADER = "CONTRACT_FILE_HEADER";
//
// public static final String VERSION_PRAGMA = "version_pragma";
// public static final String ENABLE_VERSION = "enable_version";
// public static final String GENERATE_JAVA_NONBLOCKING = "GENERATE_JAVA_NONBLOCKING";
//
//
//
// public static IPreferenceStore getPreferenceStore(IProject project) {
// if (project != null) {
// IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID);
// if(store.getBoolean(PreferenceConstants.GENERATOR_PROJECT_SETTINGS))
// return store;
// }
// return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);//Activator.PLUGIN_ID);
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.Type;
import de.urszeidler.eclipse.solidity.ui.preferences.PreferenceConstants; | }
} catch (IllegalArgumentException e) {
}
}
return new ArrayList<Object>();
}
/**
* Get the index of the given {@link NamedElement} of its container.
*
* @param clazz
* @return
*/
public static int getIndexInContainer(Element clazz) {
EObject eContainer = clazz.eContainer();
EStructuralFeature eContainingFeature = clazz.eContainingFeature();
List<?> eGet = (List<?>) eContainer.eGet(eContainingFeature);
return eGet.indexOf(clazz);
}
/**
* Returns the header for a solidity file.
*
* @param an
* element
* @return
*/
public static String getSolidityFileHeader(NamedElement clazz) {
IPreferenceStore store = getStore(clazz); | // Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/preferences/PreferenceConstants.java
// public class PreferenceConstants {
//
// public static final String GENERATE_CONTRACT_FILES = "GENERATE_CONTRACT_FILES";
// public static final String GENERATION_TARGET = "GENERATION_TARGET";
// public static final String GENERATION_TARGET_DOC = "GENERATION_TARGET_DOC";
// public static final String GENERATION_ALL_IN_ONE_FILE = "GENERATION_ALL_IN_ONE_FILE";
//
// public static final String GENERATE_JAVA_INTERFACE = "GENERATE_JAVA_INTERFACE";
// public static final String GENERATION_JAVA_INTERFACE_TARGET = "GENERATION_JAVA_INTERFACE_TARGET";
// public static final String GENERATION_JAVA_INTERFACE_PACKAGE_PREFIX = "GENERATION_JAVA_INTERFACE_PACKAGE_PREFIX";
// public static final String GENERATION_JAVA_2_SOLIDITY_TYPES = "GENERATION_JAVA_2_SOLIDITY_TYPES";
// public static final String GENERATION_JAVA_2_SOLIDITY_TYPE_PREFIX = "GENERATION_JAVA_2_SOLIDITY_TYPE_";
// public static final String GENERATE_JAVA_TESTS = "GENERATE_JAVA_TESTS";
// public static final String GENERATION_JAVA_TEST_TARGET = "GENERATION_JAVA_TEST_TARGET";
//
//
// public static final String GENERATE_WEB3 = "GENERATE_WEB3";
// public static final String GENERATE_HTML = "GENERATE_HTML";
// public static final String GENERATE_MIX = "GENERATE_MIX";
// public static final String GENERATE_MARKDOWN = "GENERATE_MARKDOWN";
//
// public static final String JS_FILE_HEADER = "JS_FILE_HEADER";
// public static final String GENERATE_JS_CONTROLLER = "GENERATE_JS_CONTROLLER";
// public static final String GENERATE_JS_CONTROLLER_TARGET = "GENERATE_JS_CONTROLLER_TARGET";
// public static final String GENERATE_JS_TEST = "GENERATE_JS_TEST";
// public static final String GENERATE_JS_TEST_TARGET = "GENERATE_JS_TEST_TARGET";
// public static final String GENERATE_ABI_TARGET = "GENERATE_ABI_TARGET";
// public static final String GENERATE_ABI = "GENERATE_ABI";
//
// public static final String GENERATOR_PROJECT_SETTINGS = "COMPILE_CONTRACTS_PROJECT_SETTINGS";
// public static final String CONTRACT_FILE_HEADER = "CONTRACT_FILE_HEADER";
//
// public static final String VERSION_PRAGMA = "version_pragma";
// public static final String ENABLE_VERSION = "enable_version";
// public static final String GENERATE_JAVA_NONBLOCKING = "GENERATE_JAVA_NONBLOCKING";
//
//
//
// public static IPreferenceStore getPreferenceStore(IProject project) {
// if (project != null) {
// IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID);
// if(store.getBoolean(PreferenceConstants.GENERATOR_PROJECT_SETTINGS))
// return store;
// }
// return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);//Activator.PLUGIN_ID);
// }
//
// }
// Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/util/Uml2Service.java
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.Type;
import de.urszeidler.eclipse.solidity.ui.preferences.PreferenceConstants;
}
} catch (IllegalArgumentException e) {
}
}
return new ArrayList<Object>();
}
/**
* Get the index of the given {@link NamedElement} of its container.
*
* @param clazz
* @return
*/
public static int getIndexInContainer(Element clazz) {
EObject eContainer = clazz.eContainer();
EStructuralFeature eContainingFeature = clazz.eContainingFeature();
List<?> eGet = (List<?>) eContainer.eGet(eContainingFeature);
return eGet.indexOf(clazz);
}
/**
* Returns the header for a solidity file.
*
* @param an
* element
* @return
*/
public static String getSolidityFileHeader(NamedElement clazz) {
IPreferenceStore store = getStore(clazz); | return store.getString(PreferenceConstants.CONTRACT_FILE_HEADER); |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/SolcCompilerPreferencePage.java | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
| import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import de.urszeidler.eclipse.solidity.compiler.support.Activator; | addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_ASM, "generate asm", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_ASM_JSON, "generate asm json", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_AST, "generate ast", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_AST_JSON, "generate ast json", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_USERDOC, "generate user doc", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_DEVDOC, "generate dev doc", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_OPCODE, "generate optcode", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_FORMAL, "generate formal", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_HASHES, "generate hashes", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
}
/**
* Initialize the preference page.
*/
public void init(IWorkbench workbench) {
// Initialize the preference page
}
@Override
protected String preferencesId() { | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/SolcCompilerPreferencePage.java
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import de.urszeidler.eclipse.solidity.compiler.support.Activator;
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_ASM, "generate asm", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_ASM_JSON, "generate asm json", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_AST, "generate ast", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_AST_JSON, "generate ast json", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_USERDOC, "generate user doc", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_DEVDOC, "generate dev doc", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_OPCODE, "generate optcode", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_FORMAL, "generate formal", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.COMPILER_HASHES, "generate hashes", BooleanFieldEditor.DEFAULT,
getFieldEditorParent()));
}
/**
* Initialize the preference page.
*/
public void init(IWorkbench workbench) {
// Initialize the preference page
}
@Override
protected String preferencesId() { | return Activator.PLUGIN_ID; |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/PreferenceConstants.java | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.compiler.support.Activator; | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SolC other = (SolC) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (path == null) {
if (other.path != null)
return false;
} else if (!path.equals(other.path))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
}
public static IPreferenceStore getPreferenceStore(IProject project) {
if (project != null) { | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// // The plug-in ID
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.compiler.support"; //$NON-NLS-1$
//
// // The shared instance
// private static Activator plugin;
//
// /**
// * The constructor
// */
// public Activator() {
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /*
// * (non-Javadoc)
// * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/support/preferences/PreferenceConstants.java
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.compiler.support.Activator;
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SolC other = (SolC) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (path == null) {
if (other.path != null)
return false;
} else if (!path.equals(other.path))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
}
public static IPreferenceStore getPreferenceStore(IProject project) {
if (project != null) { | IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID); |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/preferences/PreferenceInitializer.java | // Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// /**
// * The plug-in ID.
// */
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.ui";
//
// /**
// * The shared instance.
// */
// private static Activator plugin;
//
// /**
// * The constructor.
// */
// public Activator() {
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
// * @generated
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
// * @generated
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance.
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
//
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
| import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.ui.Activator; | package de.urszeidler.eclipse.solidity.ui.preferences;
/**
* Class used to initialize default preference values.
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
public void initializeDefaultPreferences() { | // Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// /**
// * The plug-in ID.
// */
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.ui";
//
// /**
// * The shared instance.
// */
// private static Activator plugin;
//
// /**
// * The constructor.
// */
// public Activator() {
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
// * @generated
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
// * @generated
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance.
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
//
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
// Path: de.urszeidler.eclipse.solidity.ui/src/de/urszeidler/eclipse/solidity/ui/preferences/PreferenceInitializer.java
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import de.urszeidler.eclipse.solidity.ui.Activator;
package de.urszeidler.eclipse.solidity.ui.preferences;
/**
* Class used to initialize default preference values.
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
public void initializeDefaultPreferences() { | IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID); |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/propertytester/HasBuilderTester.java | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/handler/AddBuilder.java
// public class AddBuilder extends AbstractHandler implements IHandler {
//
// @Override
// public Object execute(final ExecutionEvent event) {
// final IProject project = getProject(event);
//
// if (project != null) {
// try {
// // verify already registered builders
// if (hasBuilder(project))
// // already enabled
// return null;
//
// // add builder to project properties
// IProjectDescription description = project.getDescription();
// final ICommand buildCommand = description.newCommand();
// buildCommand.setBuilderName(SolidityBuilder.BUILDER_ID);
//
// final List<ICommand> commands = new ArrayList<ICommand>();
// commands.addAll(Arrays.asList(description.getBuildSpec()));
// commands.add(buildCommand);
//
// description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
// project.setDescription(description, null);
//
// } catch (final CoreException e) {
// Activator.logError("Error adding solc builder", e);
// }
// }
// return null;
// }
//
// public static IProject getProject(final ExecutionEvent event) {
// final ISelection selection = HandlerUtil.getCurrentSelection(event);
// if (selection instanceof IStructuredSelection) {
// final Object element = ((IStructuredSelection) selection).getFirstElement();
//
// return (IProject) Platform.getAdapterManager().getAdapter(element, IProject.class);
// }
// return null;
// }
//
// public static final boolean hasBuilder(final IProject project) {
// try {
// for (final ICommand buildSpec : project.getDescription().getBuildSpec()) {
// if (SolidityBuilder.BUILDER_ID.equals(buildSpec.getBuilderName()))
// return true;
// }
// } catch (final CoreException e) {
// }
// return false;
// }
// }
| import de.urszeidler.eclipse.solidity.compiler.handler.AddBuilder;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Platform; | /**
*
*/
package de.urszeidler.eclipse.solidity.compiler.propertytester;
/**
* @author urs
*
*/
public class HasBuilderTester extends PropertyTester {
private static final String IS_ENABLED = "isEnabled";
/*
* (non-Javadoc)
*
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
* java.lang.String, java.lang.Object[], java.lang.Object)
*/
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (IS_ENABLED.equals(property)) {
final IProject project = (IProject) Platform.getAdapterManager().getAdapter(receiver, IProject.class);
if (project != null) | // Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/handler/AddBuilder.java
// public class AddBuilder extends AbstractHandler implements IHandler {
//
// @Override
// public Object execute(final ExecutionEvent event) {
// final IProject project = getProject(event);
//
// if (project != null) {
// try {
// // verify already registered builders
// if (hasBuilder(project))
// // already enabled
// return null;
//
// // add builder to project properties
// IProjectDescription description = project.getDescription();
// final ICommand buildCommand = description.newCommand();
// buildCommand.setBuilderName(SolidityBuilder.BUILDER_ID);
//
// final List<ICommand> commands = new ArrayList<ICommand>();
// commands.addAll(Arrays.asList(description.getBuildSpec()));
// commands.add(buildCommand);
//
// description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
// project.setDescription(description, null);
//
// } catch (final CoreException e) {
// Activator.logError("Error adding solc builder", e);
// }
// }
// return null;
// }
//
// public static IProject getProject(final ExecutionEvent event) {
// final ISelection selection = HandlerUtil.getCurrentSelection(event);
// if (selection instanceof IStructuredSelection) {
// final Object element = ((IStructuredSelection) selection).getFirstElement();
//
// return (IProject) Platform.getAdapterManager().getAdapter(element, IProject.class);
// }
// return null;
// }
//
// public static final boolean hasBuilder(final IProject project) {
// try {
// for (final ICommand buildSpec : project.getDescription().getBuildSpec()) {
// if (SolidityBuilder.BUILDER_ID.equals(buildSpec.getBuilderName()))
// return true;
// }
// } catch (final CoreException e) {
// }
// return false;
// }
// }
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/propertytester/HasBuilderTester.java
import de.urszeidler.eclipse.solidity.compiler.handler.AddBuilder;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Platform;
/**
*
*/
package de.urszeidler.eclipse.solidity.compiler.propertytester;
/**
* @author urs
*
*/
public class HasBuilderTester extends PropertyTester {
private static final String IS_ENABLED = "isEnabled";
/*
* (non-Javadoc)
*
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
* java.lang.String, java.lang.Object[], java.lang.Object)
*/
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (IS_ENABLED.equals(property)) {
final IProject project = (IProject) Platform.getAdapterManager().getAdapter(receiver, IProject.class);
if (project != null) | return AddBuilder.hasBuilder(project); |
UrsZeidler/uml2solidity | de.urszeidler.eclipse.solidity.laucher.ui/src/de/urszeidler/eclipse/solidity/laucher/ui/Uml2SolidityLaunchConfigurationTabGroup.java | // Path: de.urszeidler.eclipse.solidity.laucher.ui/src/de/urszeidler/eclipse/solidity/laucher/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// private static Activator plugin;
// /**
// * The plug-in ID.
// */
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.laucher.ui";
//
// /**
// *
// */
// public Activator() {
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
// * @generated
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// @Override
// protected void initializeImageRegistry(ImageRegistry reg) {
// ImageDescriptor image = imageDescriptorFromPlugin(PLUGIN_ID, "images/solidity16.png");
// reg.put("UML2Solidity", image);
// image = imageDescriptorFromPlugin(PLUGIN_ID, "images/script_wiz.gif");
// reg.put("JsCode", image);
// image = imageDescriptorFromPlugin(PLUGIN_ID, "images/help_topic.gif");
// reg.put("OtherFiles", image);
// image = imageDescriptorFromPlugin(PLUGIN_ID, "images/javabean_obj.gif");
// reg.put("JavaCode", image);
//
// super.initializeImageRegistry(reg);
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
// * @generated
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance.
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
//
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
| import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import de.urszeidler.eclipse.solidity.laucher.Activator; | *
*/
public Uml2SolidityLaunchConfigurationTabGroup() {
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
*/
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
.getConfigurationElementsFor("de.urszeidler.eclipse.solidity.um2solidity.m2t.laucherTab");
List<LaunchingConfig> confs = new ArrayList<LaunchingConfig>();
for (IConfigurationElement element : configurationElements) {
ILaunchConfigurationTab tab;
try {
tab = (ILaunchConfigurationTab) element.createExecutableExtension("tab_class");
String orderString = element.getAttribute("tab_order");
int order = 10;
try {
order = Integer.parseInt(orderString);
} catch (NumberFormatException e) {
}
LaunchingConfig launchingConfig = new LaunchingConfig();
launchingConfig.tab = tab;
launchingConfig.order = order;
confs.add(launchingConfig);
} catch (Exception e) { | // Path: de.urszeidler.eclipse.solidity.laucher.ui/src/de/urszeidler/eclipse/solidity/laucher/Activator.java
// public class Activator extends AbstractUIPlugin {
//
// private static Activator plugin;
// /**
// * The plug-in ID.
// */
// public static final String PLUGIN_ID = "de.urszeidler.eclipse.solidity.laucher.ui";
//
// /**
// *
// */
// public Activator() {
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
// * @generated
// */
// public void start(BundleContext context) throws Exception {
// super.start(context);
// plugin = this;
// }
//
// @Override
// protected void initializeImageRegistry(ImageRegistry reg) {
// ImageDescriptor image = imageDescriptorFromPlugin(PLUGIN_ID, "images/solidity16.png");
// reg.put("UML2Solidity", image);
// image = imageDescriptorFromPlugin(PLUGIN_ID, "images/script_wiz.gif");
// reg.put("JsCode", image);
// image = imageDescriptorFromPlugin(PLUGIN_ID, "images/help_topic.gif");
// reg.put("OtherFiles", image);
// image = imageDescriptorFromPlugin(PLUGIN_ID, "images/javabean_obj.gif");
// reg.put("JavaCode", image);
//
// super.initializeImageRegistry(reg);
// }
//
// /**
// * {@inheritDoc}
// *
// * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
// * @generated
// */
// public void stop(BundleContext context) throws Exception {
// plugin = null;
// super.stop(context);
// }
//
// /**
// * Returns the shared instance.
// *
// * @return the shared instance
// */
// public static Activator getDefault() {
// return plugin;
// }
//
// public static void logError(String message, Exception e) {
// getDefault().getLog().log(createErrorStatus(message, e));
// }
//
// public static Status createErrorStatus(String message, Exception e) {
// return new Status(IStatus.ERROR, PLUGIN_ID, message, e);
// }
//
// public static void logError(String message) {
// getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
// }
//
// public static void logInfo(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// public static void logWarning(String message) {
// getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
// }
//
// }
// Path: de.urszeidler.eclipse.solidity.laucher.ui/src/de/urszeidler/eclipse/solidity/laucher/ui/Uml2SolidityLaunchConfigurationTabGroup.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import de.urszeidler.eclipse.solidity.laucher.Activator;
*
*/
public Uml2SolidityLaunchConfigurationTabGroup() {
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
*/
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
.getConfigurationElementsFor("de.urszeidler.eclipse.solidity.um2solidity.m2t.laucherTab");
List<LaunchingConfig> confs = new ArrayList<LaunchingConfig>();
for (IConfigurationElement element : configurationElements) {
ILaunchConfigurationTab tab;
try {
tab = (ILaunchConfigurationTab) element.createExecutableExtension("tab_class");
String orderString = element.getAttribute("tab_order");
int order = 10;
try {
order = Integer.parseInt(orderString);
} catch (NumberFormatException e) {
}
LaunchingConfig launchingConfig = new LaunchingConfig();
launchingConfig.tab = tab;
launchingConfig.order = order;
confs.add(launchingConfig);
} catch (Exception e) { | Activator.logError("Error instanciate the tab.", e); |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/utils/GazeUtils.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/data/Point2D.java
// public class Point2D
// {
// public float x;
// public float y;
//
// public static final float EPSILON = 1e-005f;
//
// public static final Point2D ZERO = new Point2D();
//
// public Point2D()
// {
// }
//
// public Point2D(float x, float y)
// {
// this.x = x;
// this.y = y;
// }
//
// public Point2D(Point2D point)
// {
// x = point.x;
// y = point.y;
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Point2D))
// return false;
//
// Point2D other = (Point2D) o;
//
// return
// Float.compare(this.x, other.x) == 0 &&
// Float.compare(this.y, other.y) == 0 ;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 571;
// hash = hash * 2777 + HashUtils.hash(x);
// hash = hash * 2777 + HashUtils.hash(y);
// return hash;
// }
//
// public Point2D add(Point2D p2)
// {
// return new Point2D(this.x + p2.x, this.y + p2.y);
// }
//
// public Point2D subtract(Point2D p2)
// {
// return new Point2D(this.x - p2.x, this.y - p2.y);
// }
//
// public Point2D multiply(Point2D p2)
// {
// return new Point2D(this.x * p2.x, this.y * p2.y);
// }
//
// public Point2D multiply(float k)
// {
// return new Point2D(this.x * k, this.y * k);
// }
//
// public Point2D divide(float k)
// {
// return new Point2D(this.x / k, this.y / k);
// }
//
// public float average()
// {
// return (x + y) / 2;
// }
//
// @Override
// public String toString()
// {
// return "{" + x + ", " + y + "}";
// }
// }
| import com.theeyetribe.clientsdk.data.GazeData;
import com.theeyetribe.clientsdk.data.GazeData.Eye;
import com.theeyetribe.clientsdk.data.Point2D;
import org.jetbrains.annotations.Nullable; | /*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk.utils;
/**
* Utility methods common to working with gaze estimation.
*/
public class GazeUtils
{
protected GazeUtils()
{
//ensure non-instantiability
}
/**
* Find average pupil center of two eyes.
*
* @param leftEye left eye
* @param rightEye right eye
* @return the average center point in normalized values
*/ | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/data/Point2D.java
// public class Point2D
// {
// public float x;
// public float y;
//
// public static final float EPSILON = 1e-005f;
//
// public static final Point2D ZERO = new Point2D();
//
// public Point2D()
// {
// }
//
// public Point2D(float x, float y)
// {
// this.x = x;
// this.y = y;
// }
//
// public Point2D(Point2D point)
// {
// x = point.x;
// y = point.y;
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Point2D))
// return false;
//
// Point2D other = (Point2D) o;
//
// return
// Float.compare(this.x, other.x) == 0 &&
// Float.compare(this.y, other.y) == 0 ;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 571;
// hash = hash * 2777 + HashUtils.hash(x);
// hash = hash * 2777 + HashUtils.hash(y);
// return hash;
// }
//
// public Point2D add(Point2D p2)
// {
// return new Point2D(this.x + p2.x, this.y + p2.y);
// }
//
// public Point2D subtract(Point2D p2)
// {
// return new Point2D(this.x - p2.x, this.y - p2.y);
// }
//
// public Point2D multiply(Point2D p2)
// {
// return new Point2D(this.x * p2.x, this.y * p2.y);
// }
//
// public Point2D multiply(float k)
// {
// return new Point2D(this.x * k, this.y * k);
// }
//
// public Point2D divide(float k)
// {
// return new Point2D(this.x / k, this.y / k);
// }
//
// public float average()
// {
// return (x + y) / 2;
// }
//
// @Override
// public String toString()
// {
// return "{" + x + ", " + y + "}";
// }
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/utils/GazeUtils.java
import com.theeyetribe.clientsdk.data.GazeData;
import com.theeyetribe.clientsdk.data.GazeData.Eye;
import com.theeyetribe.clientsdk.data.Point2D;
import org.jetbrains.annotations.Nullable;
/*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk.utils;
/**
* Utility methods common to working with gaze estimation.
*/
public class GazeUtils
{
protected GazeUtils()
{
//ensure non-instantiability
}
/**
* Find average pupil center of two eyes.
*
* @param leftEye left eye
* @param rightEye right eye
* @return the average center point in normalized values
*/ | public static @Nullable Point2D getEyesCenterNormalized(Eye leftEye, Eye rightEye) |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/utils/CalibUtils.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/data/Point2D.java
// public class Point2D
// {
// public float x;
// public float y;
//
// public static final float EPSILON = 1e-005f;
//
// public static final Point2D ZERO = new Point2D();
//
// public Point2D()
// {
// }
//
// public Point2D(float x, float y)
// {
// this.x = x;
// this.y = y;
// }
//
// public Point2D(Point2D point)
// {
// x = point.x;
// y = point.y;
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Point2D))
// return false;
//
// Point2D other = (Point2D) o;
//
// return
// Float.compare(this.x, other.x) == 0 &&
// Float.compare(this.y, other.y) == 0 ;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 571;
// hash = hash * 2777 + HashUtils.hash(x);
// hash = hash * 2777 + HashUtils.hash(y);
// return hash;
// }
//
// public Point2D add(Point2D p2)
// {
// return new Point2D(this.x + p2.x, this.y + p2.y);
// }
//
// public Point2D subtract(Point2D p2)
// {
// return new Point2D(this.x - p2.x, this.y - p2.y);
// }
//
// public Point2D multiply(Point2D p2)
// {
// return new Point2D(this.x * p2.x, this.y * p2.y);
// }
//
// public Point2D multiply(float k)
// {
// return new Point2D(this.x * k, this.y * k);
// }
//
// public Point2D divide(float k)
// {
// return new Point2D(this.x / k, this.y / k);
// }
//
// public float average()
// {
// return (x + y) / 2;
// }
//
// @Override
// public String toString()
// {
// return "{" + x + ", " + y + "}";
// }
// }
| import com.theeyetribe.clientsdk.data.CalibrationResult;
import com.theeyetribe.clientsdk.data.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; | {
return 4;
}
else if (cq.equals(CalibQuality.GOOD))
{
return 3;
}
else if (cq.equals(CalibQuality.MODERATE))
{
return 2;
}
else if (cq.equals(CalibQuality.POOR))
{
return 1;
}
return 0;
}
/**
* Helper method that generates geometric calibration points based on desired rect area.
* <p>
* This is useful when implementing a custom calibration UI.
*
* @param rows the number of rows in calibration point grid
* @param columns the number of columns in calibration point grid
* @param width width of the rect area to spread the calibration points in
* @param height height of the rect area to spread the calibration points in
* @return list of calibration points
*/ | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/data/Point2D.java
// public class Point2D
// {
// public float x;
// public float y;
//
// public static final float EPSILON = 1e-005f;
//
// public static final Point2D ZERO = new Point2D();
//
// public Point2D()
// {
// }
//
// public Point2D(float x, float y)
// {
// this.x = x;
// this.y = y;
// }
//
// public Point2D(Point2D point)
// {
// x = point.x;
// y = point.y;
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Point2D))
// return false;
//
// Point2D other = (Point2D) o;
//
// return
// Float.compare(this.x, other.x) == 0 &&
// Float.compare(this.y, other.y) == 0 ;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 571;
// hash = hash * 2777 + HashUtils.hash(x);
// hash = hash * 2777 + HashUtils.hash(y);
// return hash;
// }
//
// public Point2D add(Point2D p2)
// {
// return new Point2D(this.x + p2.x, this.y + p2.y);
// }
//
// public Point2D subtract(Point2D p2)
// {
// return new Point2D(this.x - p2.x, this.y - p2.y);
// }
//
// public Point2D multiply(Point2D p2)
// {
// return new Point2D(this.x * p2.x, this.y * p2.y);
// }
//
// public Point2D multiply(float k)
// {
// return new Point2D(this.x * k, this.y * k);
// }
//
// public Point2D divide(float k)
// {
// return new Point2D(this.x / k, this.y / k);
// }
//
// public float average()
// {
// return (x + y) / 2;
// }
//
// @Override
// public String toString()
// {
// return "{" + x + ", " + y + "}";
// }
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/utils/CalibUtils.java
import com.theeyetribe.clientsdk.data.CalibrationResult;
import com.theeyetribe.clientsdk.data.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
{
return 4;
}
else if (cq.equals(CalibQuality.GOOD))
{
return 3;
}
else if (cq.equals(CalibQuality.MODERATE))
{
return 2;
}
else if (cq.equals(CalibQuality.POOR))
{
return 1;
}
return 0;
}
/**
* Helper method that generates geometric calibration points based on desired rect area.
* <p>
* This is useful when implementing a custom calibration UI.
*
* @param rows the number of rows in calibration point grid
* @param columns the number of columns in calibration point grid
* @param width width of the rect area to spread the calibration points in
* @param height height of the rect area to spread the calibration points in
* @return list of calibration points
*/ | public static List<Point2D> initCalibrationPoints(int rows, int columns, int width, int height) |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/Protocol.java
// public class Protocol
// {
// private Protocol()
// {
// //ensure non-instantiability
// }
//
// public static final int STATUSCODE_CALIBRATION_UPDATE = 800;
// public static final int STATUSCODE_SCREEN_UPDATE = 801;
// public static final int STATUSCODE_TRACKER_UPDATE = 802;
//
// public static final String KEY_CATEGORY = "category";
// public static final String KEY_REQUEST = "request";
// public static final String KEY_ID = "id";
// public static final String KEY_VALUES = "values";
// public static final String KEY_STATUSCODE = "statuscode";
// public static final String KEY_STATUSMESSAGE = "statusmessage";
//
// public static final String CATEGORY_TRACKER = "tracker";
// public static final String CATEGORY_CALIBRATION = "calibration";
// //public static final String CATEGORY_HEARTBEAT = "heartbeat"; //deprecated
//
// public static final String TRACKER_REQUEST_SET = "set";
// public static final String TRACKER_REQUEST_GET = "get";
// //public static final String TRACKER_MODE_PUSH = "push"; //deprecated
// //public static final String TRACKER_HEARTBEATINTERVAL = "heartbeatinterval"; //deprecated
// public static final String TRACKER_VERSION = "version";
// public static final String TRACKER_ISCALIBRATED = "iscalibrated";
// public static final String TRACKER_ISCALIBRATING = "iscalibrating";
// public static final String TRACKER_TRACKERSTATE = "trackerstate";
// public static final String TRACKER_CALIBRATIONRESULT = "calibresult";
// public static final String TRACKER_FRAMERATE = "framerate";
// public static final String TRACKER_FRAME = "frame";
// public static final String TRACKER_SCREEN_INDEX = "screenindex";
// public static final String TRACKER_SCREEN_RESOLUTION_WIDTH = "screenresw";
// public static final String TRACKER_SCREEN_RESOLUTION_HEIGHT = "screenresh";
// public static final String TRACKER_SCREEN_PHYSICAL_WIDTH = "screenpsyw";
// public static final String TRACKER_SCREEN_PHYSICAL_HEIGHT = "screenpsyh";
//
// public static final String CALIBRATION_REQUEST_START = "start";
// public static final String CALIBRATION_REQUEST_ABORT = "abort";
// public static final String CALIBRATION_REQUEST_POINTSTART = "pointstart";
// public static final String CALIBRATION_REQUEST_POINTEND = "pointend";
// public static final String CALIBRATION_REQUEST_CLEAR = "clear";
// public static final String CALIBRATION_CALIBRESULT = "calibresult";
// public static final String CALIBRATION_CALIBPOINTS = "calibpoints";
// public static final String CALIBRATION_POINT_COUNT = "pointcount";
// public static final String CALIBRATION_X = "x";
// public static final String CALIBRATION_Y = "y";
//
// public static final String FRAME_TIME = "time";
// public static final String FRAME_TIMESTAMP = "timestamp";
// public static final String FRAME_FIXATION = "fix";
// public static final String FRAME_STATE = "state";
// public static final String FRAME_RAW_COORDINATES = "raw";
// public static final String FRAME_AVERAGE_COORDINATES = "avg";
// public static final String FRAME_X = "x";
// public static final String FRAME_Y = "y";
// public static final String FRAME_LEFT_EYE = "lefteye";
// public static final String FRAME_RIGHT_EYE = "righteye";
// public static final String FRAME_EYE_PUPIL_SIZE = "psize";
// public static final String FRAME_EYE_PUPIL_CENTER = "pcenter";
//
// public static final String CALIBRESULT_RESULT = "result";
// public static final String CALIBRESULT_AVERAGE_ERROR_DEGREES = "deg";
// public static final String CALIBRESULT_AVERAGE_ERROR_LEFT_DEGREES = "degl";
// public static final String CALIBRESULT_AVERAGE_ERROR_RIGHT_DEGREES = "degr";
// public static final String CALIBRESULT_CALIBRATION_POINTS = "calibpoints";
// public static final String CALIBRESULT_STATE = "state";
// public static final String CALIBRESULT_COORDINATES = "cp";
// public static final String CALIBRESULT_X = "x";
// public static final String CALIBRESULT_Y = "y";
// public static final String CALIBRESULT_MEAN_ESTIMATED_COORDINATES = "mecp";
// public static final String CALIBRESULT_ACCURACIES_DEGREES = "acd";
// public static final String CALIBRESULT_ACCURACY_AVERAGE_DEGREES = "ad";
// public static final String CALIBRESULT_ACCURACY_LEFT_DEGREES = "adl";
// public static final String CALIBRESULT_ACCURACY_RIGHT_DEGREES = "adr";
// public static final String CALIBRESULT_MEAN_ERRORS_PIXELS = "mepix";
// public static final String CALIBRESULT_MEAN_ERROR_AVERAGE_PIXELS = "mep";
// public static final String CALIBRESULT_MEAN_ERROR_LEFT_PIXELS = "mepl";
// public static final String CALIBRESULT_MEAN_ERROR_RIGHT_PIXELS = "mepr";
// public static final String CALIBRESULT_STANDARD_DEVIATION_PIXELS = "asdp";
// public static final String CALIBRESULT_STANDARD_DEVIATION_AVERAGE_PIXELS = "asd";
// public static final String CALIBRESULT_STANDARD_DEVIATION_LEFT_PIXELS = "asdl";
// public static final String CALIBRESULT_STANDARD_DEVIATION_RIGHT_PIXELS = "asdr";
// }
| import com.google.gson.annotations.SerializedName;
import com.theeyetribe.clientsdk.Protocol; | /*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk.response;
/**
* ResponseFailed is the responses to a failed request in the EyeTribe API
*
* @see <a href="http://dev.theeyetribe.com/api/#api">EyeTribe API - Client Message</a>
*/
public class ResponseFailed extends Response
{
public static class Values
{ | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/Protocol.java
// public class Protocol
// {
// private Protocol()
// {
// //ensure non-instantiability
// }
//
// public static final int STATUSCODE_CALIBRATION_UPDATE = 800;
// public static final int STATUSCODE_SCREEN_UPDATE = 801;
// public static final int STATUSCODE_TRACKER_UPDATE = 802;
//
// public static final String KEY_CATEGORY = "category";
// public static final String KEY_REQUEST = "request";
// public static final String KEY_ID = "id";
// public static final String KEY_VALUES = "values";
// public static final String KEY_STATUSCODE = "statuscode";
// public static final String KEY_STATUSMESSAGE = "statusmessage";
//
// public static final String CATEGORY_TRACKER = "tracker";
// public static final String CATEGORY_CALIBRATION = "calibration";
// //public static final String CATEGORY_HEARTBEAT = "heartbeat"; //deprecated
//
// public static final String TRACKER_REQUEST_SET = "set";
// public static final String TRACKER_REQUEST_GET = "get";
// //public static final String TRACKER_MODE_PUSH = "push"; //deprecated
// //public static final String TRACKER_HEARTBEATINTERVAL = "heartbeatinterval"; //deprecated
// public static final String TRACKER_VERSION = "version";
// public static final String TRACKER_ISCALIBRATED = "iscalibrated";
// public static final String TRACKER_ISCALIBRATING = "iscalibrating";
// public static final String TRACKER_TRACKERSTATE = "trackerstate";
// public static final String TRACKER_CALIBRATIONRESULT = "calibresult";
// public static final String TRACKER_FRAMERATE = "framerate";
// public static final String TRACKER_FRAME = "frame";
// public static final String TRACKER_SCREEN_INDEX = "screenindex";
// public static final String TRACKER_SCREEN_RESOLUTION_WIDTH = "screenresw";
// public static final String TRACKER_SCREEN_RESOLUTION_HEIGHT = "screenresh";
// public static final String TRACKER_SCREEN_PHYSICAL_WIDTH = "screenpsyw";
// public static final String TRACKER_SCREEN_PHYSICAL_HEIGHT = "screenpsyh";
//
// public static final String CALIBRATION_REQUEST_START = "start";
// public static final String CALIBRATION_REQUEST_ABORT = "abort";
// public static final String CALIBRATION_REQUEST_POINTSTART = "pointstart";
// public static final String CALIBRATION_REQUEST_POINTEND = "pointend";
// public static final String CALIBRATION_REQUEST_CLEAR = "clear";
// public static final String CALIBRATION_CALIBRESULT = "calibresult";
// public static final String CALIBRATION_CALIBPOINTS = "calibpoints";
// public static final String CALIBRATION_POINT_COUNT = "pointcount";
// public static final String CALIBRATION_X = "x";
// public static final String CALIBRATION_Y = "y";
//
// public static final String FRAME_TIME = "time";
// public static final String FRAME_TIMESTAMP = "timestamp";
// public static final String FRAME_FIXATION = "fix";
// public static final String FRAME_STATE = "state";
// public static final String FRAME_RAW_COORDINATES = "raw";
// public static final String FRAME_AVERAGE_COORDINATES = "avg";
// public static final String FRAME_X = "x";
// public static final String FRAME_Y = "y";
// public static final String FRAME_LEFT_EYE = "lefteye";
// public static final String FRAME_RIGHT_EYE = "righteye";
// public static final String FRAME_EYE_PUPIL_SIZE = "psize";
// public static final String FRAME_EYE_PUPIL_CENTER = "pcenter";
//
// public static final String CALIBRESULT_RESULT = "result";
// public static final String CALIBRESULT_AVERAGE_ERROR_DEGREES = "deg";
// public static final String CALIBRESULT_AVERAGE_ERROR_LEFT_DEGREES = "degl";
// public static final String CALIBRESULT_AVERAGE_ERROR_RIGHT_DEGREES = "degr";
// public static final String CALIBRESULT_CALIBRATION_POINTS = "calibpoints";
// public static final String CALIBRESULT_STATE = "state";
// public static final String CALIBRESULT_COORDINATES = "cp";
// public static final String CALIBRESULT_X = "x";
// public static final String CALIBRESULT_Y = "y";
// public static final String CALIBRESULT_MEAN_ESTIMATED_COORDINATES = "mecp";
// public static final String CALIBRESULT_ACCURACIES_DEGREES = "acd";
// public static final String CALIBRESULT_ACCURACY_AVERAGE_DEGREES = "ad";
// public static final String CALIBRESULT_ACCURACY_LEFT_DEGREES = "adl";
// public static final String CALIBRESULT_ACCURACY_RIGHT_DEGREES = "adr";
// public static final String CALIBRESULT_MEAN_ERRORS_PIXELS = "mepix";
// public static final String CALIBRESULT_MEAN_ERROR_AVERAGE_PIXELS = "mep";
// public static final String CALIBRESULT_MEAN_ERROR_LEFT_PIXELS = "mepl";
// public static final String CALIBRESULT_MEAN_ERROR_RIGHT_PIXELS = "mepr";
// public static final String CALIBRESULT_STANDARD_DEVIATION_PIXELS = "asdp";
// public static final String CALIBRESULT_STANDARD_DEVIATION_AVERAGE_PIXELS = "asd";
// public static final String CALIBRESULT_STANDARD_DEVIATION_LEFT_PIXELS = "asdl";
// public static final String CALIBRESULT_STANDARD_DEVIATION_RIGHT_PIXELS = "asdr";
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java
import com.google.gson.annotations.SerializedName;
import com.theeyetribe.clientsdk.Protocol;
/*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk.response;
/**
* ResponseFailed is the responses to a failed request in the EyeTribe API
*
* @see <a href="http://dev.theeyetribe.com/api/#api">EyeTribe API - Client Message</a>
*/
public class ResponseFailed extends Response
{
public static class Values
{ | @SerializedName(Protocol.KEY_STATUSMESSAGE) |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/GazeApiManager.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/CalibrationPointEndResponse.java
// public class CalibrationPointEndResponse extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.CALIBRATION_CALIBRESULT)
// public CalibrationResult calibrationResult;
// }
//
// public Values values = new Values();
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java
// public class ResponseFailed extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.KEY_STATUSMESSAGE)
// public String statusMessage;
// }
//
// public Values values = new Values();
// }
| import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.theeyetribe.clientsdk.request.*;
import com.theeyetribe.clientsdk.response.CalibrationPointEndResponse;
import com.theeyetribe.clientsdk.response.Response;
import com.theeyetribe.clientsdk.response.ResponseFailed;
import com.theeyetribe.clientsdk.response.TrackerGetResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger; | csr.asyncLock = new Object();
request(csr);
return csr.asyncLock;
}
public void requestCalibrationPointStart(int x, int y)
{
CalibrationPointStartRequest cpsr = new CalibrationPointStartRequest();
cpsr.values.x = x;
cpsr.values.y = y;
cpsr.id = mIdGenerator.incrementAndGet();
request(cpsr);
}
public void requestCalibrationPointEnd()
{
CalibrationPointEndRequest cper = new CalibrationPointEndRequest();
cper.id = mIdGenerator.incrementAndGet();
request(cper);
}
public Object requestCalibrationAbort()
{ | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/CalibrationPointEndResponse.java
// public class CalibrationPointEndResponse extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.CALIBRATION_CALIBRESULT)
// public CalibrationResult calibrationResult;
// }
//
// public Values values = new Values();
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java
// public class ResponseFailed extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.KEY_STATUSMESSAGE)
// public String statusMessage;
// }
//
// public Values values = new Values();
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/GazeApiManager.java
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.theeyetribe.clientsdk.request.*;
import com.theeyetribe.clientsdk.response.CalibrationPointEndResponse;
import com.theeyetribe.clientsdk.response.Response;
import com.theeyetribe.clientsdk.response.ResponseFailed;
import com.theeyetribe.clientsdk.response.TrackerGetResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
csr.asyncLock = new Object();
request(csr);
return csr.asyncLock;
}
public void requestCalibrationPointStart(int x, int y)
{
CalibrationPointStartRequest cpsr = new CalibrationPointStartRequest();
cpsr.values.x = x;
cpsr.values.y = y;
cpsr.id = mIdGenerator.incrementAndGet();
request(cpsr);
}
public void requestCalibrationPointEnd()
{
CalibrationPointEndRequest cper = new CalibrationPointEndRequest();
cper.id = mIdGenerator.incrementAndGet();
request(cper);
}
public Object requestCalibrationAbort()
{ | Request r = new Request<>(Response.class); |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/GazeApiManager.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/CalibrationPointEndResponse.java
// public class CalibrationPointEndResponse extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.CALIBRATION_CALIBRESULT)
// public CalibrationResult calibrationResult;
// }
//
// public Values values = new Values();
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java
// public class ResponseFailed extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.KEY_STATUSMESSAGE)
// public String statusMessage;
// }
//
// public Values values = new Values();
// }
| import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.theeyetribe.clientsdk.request.*;
import com.theeyetribe.clientsdk.response.CalibrationPointEndResponse;
import com.theeyetribe.clientsdk.response.Response;
import com.theeyetribe.clientsdk.response.ResponseFailed;
import com.theeyetribe.clientsdk.response.TrackerGetResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger; | InputStreamReader isr = new InputStreamReader(is, "UTF-8");
reader = new BufferedReader(isr);
while (!Thread.interrupted())
{
while ((responseJson = reader.readLine()) != null)
{
if (!responseJson.isEmpty() && null != mResponseListener)
{
if(GazeManager.IS_DEBUG_MODE)
System.out.println("IN: " + responseJson);
jo = (JsonObject) jsonParser.parse(responseJson);
int id = null != jo.get(Protocol.KEY_ID) ? jo.get(Protocol.KEY_ID).getAsInt() : 0;
request = mOngoingRequests.containsKey(id) ? mOngoingRequests.remove(id) : null;
if (jo.get(Protocol.KEY_STATUSCODE).getAsInt() == HttpURLConnection.HTTP_OK)
{
if(request != null)
{
//matching request handles parsing
response = (Response) request.parseJsonResponse(jo, mGson);
response.transitTime = System.currentTimeMillis() - request.timeStamp;
}
else
{
// Incoming message has no id and is a reponse to a process or a pushed gaze data frame
if (jo.get(Protocol.KEY_CATEGORY).getAsString().equals(Protocol.CATEGORY_CALIBRATION))
{
// response is calibration result | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/CalibrationPointEndResponse.java
// public class CalibrationPointEndResponse extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.CALIBRATION_CALIBRESULT)
// public CalibrationResult calibrationResult;
// }
//
// public Values values = new Values();
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java
// public class ResponseFailed extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.KEY_STATUSMESSAGE)
// public String statusMessage;
// }
//
// public Values values = new Values();
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/GazeApiManager.java
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.theeyetribe.clientsdk.request.*;
import com.theeyetribe.clientsdk.response.CalibrationPointEndResponse;
import com.theeyetribe.clientsdk.response.Response;
import com.theeyetribe.clientsdk.response.ResponseFailed;
import com.theeyetribe.clientsdk.response.TrackerGetResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
reader = new BufferedReader(isr);
while (!Thread.interrupted())
{
while ((responseJson = reader.readLine()) != null)
{
if (!responseJson.isEmpty() && null != mResponseListener)
{
if(GazeManager.IS_DEBUG_MODE)
System.out.println("IN: " + responseJson);
jo = (JsonObject) jsonParser.parse(responseJson);
int id = null != jo.get(Protocol.KEY_ID) ? jo.get(Protocol.KEY_ID).getAsInt() : 0;
request = mOngoingRequests.containsKey(id) ? mOngoingRequests.remove(id) : null;
if (jo.get(Protocol.KEY_STATUSCODE).getAsInt() == HttpURLConnection.HTTP_OK)
{
if(request != null)
{
//matching request handles parsing
response = (Response) request.parseJsonResponse(jo, mGson);
response.transitTime = System.currentTimeMillis() - request.timeStamp;
}
else
{
// Incoming message has no id and is a reponse to a process or a pushed gaze data frame
if (jo.get(Protocol.KEY_CATEGORY).getAsString().equals(Protocol.CATEGORY_CALIBRATION))
{
// response is calibration result | response = mGson.fromJson(jo, CalibrationPointEndResponse.class); |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/GazeApiManager.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/CalibrationPointEndResponse.java
// public class CalibrationPointEndResponse extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.CALIBRATION_CALIBRESULT)
// public CalibrationResult calibrationResult;
// }
//
// public Values values = new Values();
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java
// public class ResponseFailed extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.KEY_STATUSMESSAGE)
// public String statusMessage;
// }
//
// public Values values = new Values();
// }
| import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.theeyetribe.clientsdk.request.*;
import com.theeyetribe.clientsdk.response.CalibrationPointEndResponse;
import com.theeyetribe.clientsdk.response.Response;
import com.theeyetribe.clientsdk.response.ResponseFailed;
import com.theeyetribe.clientsdk.response.TrackerGetResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger; | if (jo.get(Protocol.KEY_STATUSCODE).getAsInt() == HttpURLConnection.HTTP_OK)
{
if(request != null)
{
//matching request handles parsing
response = (Response) request.parseJsonResponse(jo, mGson);
response.transitTime = System.currentTimeMillis() - request.timeStamp;
}
else
{
// Incoming message has no id and is a reponse to a process or a pushed gaze data frame
if (jo.get(Protocol.KEY_CATEGORY).getAsString().equals(Protocol.CATEGORY_CALIBRATION))
{
// response is calibration result
response = mGson.fromJson(jo, CalibrationPointEndResponse.class);
}
else if (null != (response = parseIncomingProcessResponse(jo)))
{
// We allow the network layer extensions to optionally handle the process response
}
else
{
// response is gaze data frame
response = mGson.fromJson(jo, TrackerGetResponse.class);
}
}
}
else
{
//request failed | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/CalibrationPointEndResponse.java
// public class CalibrationPointEndResponse extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.CALIBRATION_CALIBRESULT)
// public CalibrationResult calibrationResult;
// }
//
// public Values values = new Values();
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/ResponseFailed.java
// public class ResponseFailed extends Response
// {
// public static class Values
// {
// @SerializedName(Protocol.KEY_STATUSMESSAGE)
// public String statusMessage;
// }
//
// public Values values = new Values();
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/GazeApiManager.java
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.theeyetribe.clientsdk.request.*;
import com.theeyetribe.clientsdk.response.CalibrationPointEndResponse;
import com.theeyetribe.clientsdk.response.Response;
import com.theeyetribe.clientsdk.response.ResponseFailed;
import com.theeyetribe.clientsdk.response.TrackerGetResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
if (jo.get(Protocol.KEY_STATUSCODE).getAsInt() == HttpURLConnection.HTTP_OK)
{
if(request != null)
{
//matching request handles parsing
response = (Response) request.parseJsonResponse(jo, mGson);
response.transitTime = System.currentTimeMillis() - request.timeStamp;
}
else
{
// Incoming message has no id and is a reponse to a process or a pushed gaze data frame
if (jo.get(Protocol.KEY_CATEGORY).getAsString().equals(Protocol.CATEGORY_CALIBRATION))
{
// response is calibration result
response = mGson.fromJson(jo, CalibrationPointEndResponse.class);
}
else if (null != (response = parseIncomingProcessResponse(jo)))
{
// We allow the network layer extensions to optionally handle the process response
}
else
{
// response is gaze data frame
response = mGson.fromJson(jo, TrackerGetResponse.class);
}
}
}
else
{
//request failed | response = mGson.fromJson(jo, ResponseFailed.class); |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/GazeManager.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/request/Request.java
// public class Request<T> implements Comparable<Request<T>>
// {
// public String category;
// public String request;
// public int id;
//
// private transient boolean mCanceled;
//
// public transient long timeStamp;
//
// public transient int retryAttempts;
//
// public transient Object asyncLock;
//
// private transient final Class<T> type;
//
// public Request(Class<T> type) {
// this.type = type;
// }
//
// public T parseJsonResponse(JsonObject response, Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("parseJsonResponse: " + type.getSimpleName());
//
// return gson.fromJson(response, type);
// }
//
// public String toJsonString(Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("toJsonString: " + this.getClass().getSimpleName());
//
// return gson.toJson(this, this.getClass());
// }
//
// public void cancel()
// {
// mCanceled = true;
// finish();
// }
//
// public boolean isCancelled()
// {
// return mCanceled;
// }
//
// public void finish()
// {
// if(null != asyncLock)
// {
// synchronized (asyncLock)
// {
// asyncLock.notify();
// }
// }
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Request))
// return false;
//
// Request other = (Request) o;
//
// return category.equals(other.category) &&
// request.equals(other.request) &&
// id == other.id;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 1471;
// hash = hash * 1151 + category.hashCode();
// hash = hash * 1151 + request.hashCode();
// hash = hash * 1151 + HashUtils.hash(id);
// return hash;
// }
//
// @Override
// public int compareTo(Request other)
// {
// if(this.equals(other))
// return 0;
//
// if(this.id != 0 && other.id == 0)
// return -1;
//
// if(this.id == 0 && other.id != 0)
// return 1;
//
// //if(this.id != 0 && other.id != 0)
// return this.id < other.id ? -1 : 1;
// }
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
| import com.theeyetribe.clientsdk.data.GazeData;
import com.theeyetribe.clientsdk.request.Request;
import com.theeyetribe.clientsdk.response.Response; | /*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk;
/**
* GazeManager is the main entry point of the EyeTribe Java SDK. It exposes all routines associated to gaze control.
* <p>
* Using this class a developer can connect to the EyeTribe Server, <i>calibrate</i> the eye tracking system and attach
* listeners to receive live data streams of {@link GazeData} updates. Note that this is a thin wrapper class. The Core
* SDK implementation can be found in {@link GazeManagerCore}.
* <p>
* GazeManager must establish a connection to the EyeTribe Server before it can be used. This is achieved by calling
* {@link #activate() activate}. GazeManager must be shut down by calling {@link #deactivate() deactivate}.
* <p>
* A standard pattern for using GazeManager in a Java FX Application can be seen below:
* <pre>
* public class Main extends Application{
*
* public static void main(String[] args)
* {
* launch(args);
* }
*
* \@Override
* public void start(Stage primaryStage) throws Exception
* {
* GazeManager.getInstance().activateAsync();
* }
*
* \@Override
* public void stop() throws Exception
* {
* GazeManager.getInstance().deactivate();
* }
* }
* </pre>
*/
public class GazeManager extends GazeManagerCore
{
private GazeManager()
{
super();
}
public static GazeManager getInstance()
{
return Holder.INSTANCE;
}
private static class Holder
{
// thread-safe initialization on demand
static final GazeManager INSTANCE = new GazeManager();
}
protected GazeApiManager createApiManager(GazeApiManager.IGazeApiResponseListener responseListener, GazeApiManager.IGazeApiConnectionListener connectionListener)
{
return new GazeApiManager(responseListener, connectionListener);
}
| // Path: sdk/src/main/java/com/theeyetribe/clientsdk/request/Request.java
// public class Request<T> implements Comparable<Request<T>>
// {
// public String category;
// public String request;
// public int id;
//
// private transient boolean mCanceled;
//
// public transient long timeStamp;
//
// public transient int retryAttempts;
//
// public transient Object asyncLock;
//
// private transient final Class<T> type;
//
// public Request(Class<T> type) {
// this.type = type;
// }
//
// public T parseJsonResponse(JsonObject response, Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("parseJsonResponse: " + type.getSimpleName());
//
// return gson.fromJson(response, type);
// }
//
// public String toJsonString(Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("toJsonString: " + this.getClass().getSimpleName());
//
// return gson.toJson(this, this.getClass());
// }
//
// public void cancel()
// {
// mCanceled = true;
// finish();
// }
//
// public boolean isCancelled()
// {
// return mCanceled;
// }
//
// public void finish()
// {
// if(null != asyncLock)
// {
// synchronized (asyncLock)
// {
// asyncLock.notify();
// }
// }
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Request))
// return false;
//
// Request other = (Request) o;
//
// return category.equals(other.category) &&
// request.equals(other.request) &&
// id == other.id;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 1471;
// hash = hash * 1151 + category.hashCode();
// hash = hash * 1151 + request.hashCode();
// hash = hash * 1151 + HashUtils.hash(id);
// return hash;
// }
//
// @Override
// public int compareTo(Request other)
// {
// if(this.equals(other))
// return 0;
//
// if(this.id != 0 && other.id == 0)
// return -1;
//
// if(this.id == 0 && other.id != 0)
// return 1;
//
// //if(this.id != 0 && other.id != 0)
// return this.id < other.id ? -1 : 1;
// }
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/GazeManager.java
import com.theeyetribe.clientsdk.data.GazeData;
import com.theeyetribe.clientsdk.request.Request;
import com.theeyetribe.clientsdk.response.Response;
/*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk;
/**
* GazeManager is the main entry point of the EyeTribe Java SDK. It exposes all routines associated to gaze control.
* <p>
* Using this class a developer can connect to the EyeTribe Server, <i>calibrate</i> the eye tracking system and attach
* listeners to receive live data streams of {@link GazeData} updates. Note that this is a thin wrapper class. The Core
* SDK implementation can be found in {@link GazeManagerCore}.
* <p>
* GazeManager must establish a connection to the EyeTribe Server before it can be used. This is achieved by calling
* {@link #activate() activate}. GazeManager must be shut down by calling {@link #deactivate() deactivate}.
* <p>
* A standard pattern for using GazeManager in a Java FX Application can be seen below:
* <pre>
* public class Main extends Application{
*
* public static void main(String[] args)
* {
* launch(args);
* }
*
* \@Override
* public void start(Stage primaryStage) throws Exception
* {
* GazeManager.getInstance().activateAsync();
* }
*
* \@Override
* public void stop() throws Exception
* {
* GazeManager.getInstance().deactivate();
* }
* }
* </pre>
*/
public class GazeManager extends GazeManagerCore
{
private GazeManager()
{
super();
}
public static GazeManager getInstance()
{
return Holder.INSTANCE;
}
private static class Holder
{
// thread-safe initialization on demand
static final GazeManager INSTANCE = new GazeManager();
}
protected GazeApiManager createApiManager(GazeApiManager.IGazeApiResponseListener responseListener, GazeApiManager.IGazeApiConnectionListener connectionListener)
{
return new GazeApiManager(responseListener, connectionListener);
}
| protected boolean parseApiResponse(final Response response, final Request request) |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/GazeManager.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/request/Request.java
// public class Request<T> implements Comparable<Request<T>>
// {
// public String category;
// public String request;
// public int id;
//
// private transient boolean mCanceled;
//
// public transient long timeStamp;
//
// public transient int retryAttempts;
//
// public transient Object asyncLock;
//
// private transient final Class<T> type;
//
// public Request(Class<T> type) {
// this.type = type;
// }
//
// public T parseJsonResponse(JsonObject response, Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("parseJsonResponse: " + type.getSimpleName());
//
// return gson.fromJson(response, type);
// }
//
// public String toJsonString(Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("toJsonString: " + this.getClass().getSimpleName());
//
// return gson.toJson(this, this.getClass());
// }
//
// public void cancel()
// {
// mCanceled = true;
// finish();
// }
//
// public boolean isCancelled()
// {
// return mCanceled;
// }
//
// public void finish()
// {
// if(null != asyncLock)
// {
// synchronized (asyncLock)
// {
// asyncLock.notify();
// }
// }
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Request))
// return false;
//
// Request other = (Request) o;
//
// return category.equals(other.category) &&
// request.equals(other.request) &&
// id == other.id;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 1471;
// hash = hash * 1151 + category.hashCode();
// hash = hash * 1151 + request.hashCode();
// hash = hash * 1151 + HashUtils.hash(id);
// return hash;
// }
//
// @Override
// public int compareTo(Request other)
// {
// if(this.equals(other))
// return 0;
//
// if(this.id != 0 && other.id == 0)
// return -1;
//
// if(this.id == 0 && other.id != 0)
// return 1;
//
// //if(this.id != 0 && other.id != 0)
// return this.id < other.id ? -1 : 1;
// }
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
| import com.theeyetribe.clientsdk.data.GazeData;
import com.theeyetribe.clientsdk.request.Request;
import com.theeyetribe.clientsdk.response.Response; | /*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk;
/**
* GazeManager is the main entry point of the EyeTribe Java SDK. It exposes all routines associated to gaze control.
* <p>
* Using this class a developer can connect to the EyeTribe Server, <i>calibrate</i> the eye tracking system and attach
* listeners to receive live data streams of {@link GazeData} updates. Note that this is a thin wrapper class. The Core
* SDK implementation can be found in {@link GazeManagerCore}.
* <p>
* GazeManager must establish a connection to the EyeTribe Server before it can be used. This is achieved by calling
* {@link #activate() activate}. GazeManager must be shut down by calling {@link #deactivate() deactivate}.
* <p>
* A standard pattern for using GazeManager in a Java FX Application can be seen below:
* <pre>
* public class Main extends Application{
*
* public static void main(String[] args)
* {
* launch(args);
* }
*
* \@Override
* public void start(Stage primaryStage) throws Exception
* {
* GazeManager.getInstance().activateAsync();
* }
*
* \@Override
* public void stop() throws Exception
* {
* GazeManager.getInstance().deactivate();
* }
* }
* </pre>
*/
public class GazeManager extends GazeManagerCore
{
private GazeManager()
{
super();
}
public static GazeManager getInstance()
{
return Holder.INSTANCE;
}
private static class Holder
{
// thread-safe initialization on demand
static final GazeManager INSTANCE = new GazeManager();
}
protected GazeApiManager createApiManager(GazeApiManager.IGazeApiResponseListener responseListener, GazeApiManager.IGazeApiConnectionListener connectionListener)
{
return new GazeApiManager(responseListener, connectionListener);
}
| // Path: sdk/src/main/java/com/theeyetribe/clientsdk/request/Request.java
// public class Request<T> implements Comparable<Request<T>>
// {
// public String category;
// public String request;
// public int id;
//
// private transient boolean mCanceled;
//
// public transient long timeStamp;
//
// public transient int retryAttempts;
//
// public transient Object asyncLock;
//
// private transient final Class<T> type;
//
// public Request(Class<T> type) {
// this.type = type;
// }
//
// public T parseJsonResponse(JsonObject response, Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("parseJsonResponse: " + type.getSimpleName());
//
// return gson.fromJson(response, type);
// }
//
// public String toJsonString(Gson gson)
// {
// if(GazeManager.IS_DEBUG_MODE)
// System.out.println("toJsonString: " + this.getClass().getSimpleName());
//
// return gson.toJson(this, this.getClass());
// }
//
// public void cancel()
// {
// mCanceled = true;
// finish();
// }
//
// public boolean isCancelled()
// {
// return mCanceled;
// }
//
// public void finish()
// {
// if(null != asyncLock)
// {
// synchronized (asyncLock)
// {
// asyncLock.notify();
// }
// }
// }
//
// @Override
// public boolean equals(Object o)
// {
// if (this == o)
// return true;
//
// if (!(o instanceof Request))
// return false;
//
// Request other = (Request) o;
//
// return category.equals(other.category) &&
// request.equals(other.request) &&
// id == other.id;
// }
//
// @Override
// public int hashCode()
// {
// int hash = 1471;
// hash = hash * 1151 + category.hashCode();
// hash = hash * 1151 + request.hashCode();
// hash = hash * 1151 + HashUtils.hash(id);
// return hash;
// }
//
// @Override
// public int compareTo(Request other)
// {
// if(this.equals(other))
// return 0;
//
// if(this.id != 0 && other.id == 0)
// return -1;
//
// if(this.id == 0 && other.id != 0)
// return 1;
//
// //if(this.id != 0 && other.id != 0)
// return this.id < other.id ? -1 : 1;
// }
// }
//
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/response/Response.java
// public class Response
// {
// public String category;
// public String request;
// public int id;
// public int statuscode;
//
// public transient long transitTime;
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/GazeManager.java
import com.theeyetribe.clientsdk.data.GazeData;
import com.theeyetribe.clientsdk.request.Request;
import com.theeyetribe.clientsdk.response.Response;
/*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk;
/**
* GazeManager is the main entry point of the EyeTribe Java SDK. It exposes all routines associated to gaze control.
* <p>
* Using this class a developer can connect to the EyeTribe Server, <i>calibrate</i> the eye tracking system and attach
* listeners to receive live data streams of {@link GazeData} updates. Note that this is a thin wrapper class. The Core
* SDK implementation can be found in {@link GazeManagerCore}.
* <p>
* GazeManager must establish a connection to the EyeTribe Server before it can be used. This is achieved by calling
* {@link #activate() activate}. GazeManager must be shut down by calling {@link #deactivate() deactivate}.
* <p>
* A standard pattern for using GazeManager in a Java FX Application can be seen below:
* <pre>
* public class Main extends Application{
*
* public static void main(String[] args)
* {
* launch(args);
* }
*
* \@Override
* public void start(Stage primaryStage) throws Exception
* {
* GazeManager.getInstance().activateAsync();
* }
*
* \@Override
* public void stop() throws Exception
* {
* GazeManager.getInstance().deactivate();
* }
* }
* </pre>
*/
public class GazeManager extends GazeManagerCore
{
private GazeManager()
{
super();
}
public static GazeManager getInstance()
{
return Holder.INSTANCE;
}
private static class Holder
{
// thread-safe initialization on demand
static final GazeManager INSTANCE = new GazeManager();
}
protected GazeApiManager createApiManager(GazeApiManager.IGazeApiResponseListener responseListener, GazeApiManager.IGazeApiConnectionListener connectionListener)
{
return new GazeApiManager(responseListener, connectionListener);
}
| protected boolean parseApiResponse(final Response response, final Request request) |
EyeTribe/tet-java-client | sdk/src/main/java/com/theeyetribe/clientsdk/request/Request.java | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/GazeManager.java
// public class GazeManager extends GazeManagerCore
// {
// private GazeManager()
// {
// super();
// }
//
// public static GazeManager getInstance()
// {
// return Holder.INSTANCE;
// }
//
// private static class Holder
// {
// // thread-safe initialization on demand
// static final GazeManager INSTANCE = new GazeManager();
// }
//
// protected GazeApiManager createApiManager(GazeApiManager.IGazeApiResponseListener responseListener, GazeApiManager.IGazeApiConnectionListener connectionListener)
// {
// return new GazeApiManager(responseListener, connectionListener);
// }
//
// protected boolean parseApiResponse(final Response response, final Request request)
// {
// return false;
// }
// }
| import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.theeyetribe.clientsdk.GazeManager;
import com.theeyetribe.clientsdk.utils.HashUtils; | /*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk.request;
/**
* Request is the generic base class for requests in the EyeTribe API
*
* @see <a href="http://dev.theeyetribe.com/api/#api">EyeTribe API - Client Message</a>
*/
public class Request<T> implements Comparable<Request<T>>
{
public String category;
public String request;
public int id;
private transient boolean mCanceled;
public transient long timeStamp;
public transient int retryAttempts;
public transient Object asyncLock;
private transient final Class<T> type;
public Request(Class<T> type) {
this.type = type;
}
public T parseJsonResponse(JsonObject response, Gson gson)
{ | // Path: sdk/src/main/java/com/theeyetribe/clientsdk/GazeManager.java
// public class GazeManager extends GazeManagerCore
// {
// private GazeManager()
// {
// super();
// }
//
// public static GazeManager getInstance()
// {
// return Holder.INSTANCE;
// }
//
// private static class Holder
// {
// // thread-safe initialization on demand
// static final GazeManager INSTANCE = new GazeManager();
// }
//
// protected GazeApiManager createApiManager(GazeApiManager.IGazeApiResponseListener responseListener, GazeApiManager.IGazeApiConnectionListener connectionListener)
// {
// return new GazeApiManager(responseListener, connectionListener);
// }
//
// protected boolean parseApiResponse(final Response response, final Request request)
// {
// return false;
// }
// }
// Path: sdk/src/main/java/com/theeyetribe/clientsdk/request/Request.java
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.theeyetribe.clientsdk.GazeManager;
import com.theeyetribe.clientsdk.utils.HashUtils;
/*
* Copyright (c) 2013-present, The Eye Tribe.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
*
*/
package com.theeyetribe.clientsdk.request;
/**
* Request is the generic base class for requests in the EyeTribe API
*
* @see <a href="http://dev.theeyetribe.com/api/#api">EyeTribe API - Client Message</a>
*/
public class Request<T> implements Comparable<Request<T>>
{
public String category;
public String request;
public int id;
private transient boolean mCanceled;
public transient long timeStamp;
public transient int retryAttempts;
public transient Object asyncLock;
private transient final Class<T> type;
public Request(Class<T> type) {
this.type = type;
}
public T parseJsonResponse(JsonObject response, Gson gson)
{ | if(GazeManager.IS_DEBUG_MODE) |
DisappointedPig/DPMIDI | midi/src/main/java/com/disappointedpig/midi/MIDIPort.java | // Path: midi/src/main/java/com/disappointedpig/midi/internal_events/PacketEvent.java
// public class PacketEvent {
// private InetAddress address;
// private int port;
// private byte[] data;
// private int length;
// public PacketEvent(final DatagramPacket packet) {
// address = packet.getAddress();
// port = packet.getPort();
// data = packet.getData();
// length = packet.getLength();
// // Log.d("PacketEvent"," p:"+packet.getLength()+ " d:"+data.length);
// }
//
// public Bundle getRInfo() {
// Bundle rinfo = new Bundle();
// rinfo.putString(com.disappointedpig.midi.MIDIConstants.RINFO_ADDR,address.getHostAddress());
// rinfo.putInt(MIDIConstants.RINFO_PORT,port);
// return rinfo;
// }
//
// public InetAddress getAddress() {
// return address;
// }
//
// public int getPort() {
// return port;
// }
//
// public byte[] getData() {
// return data;
// }
//
// public int getLength() {
// return data.length;
// }
// }
| import android.os.Bundle;
import android.util.Log;
import com.disappointedpig.midi.internal_events.PacketEvent;
import org.greenrobot.eventbus.EventBus;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.Iterator;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue; | return thread.getPriority();
}
void setThreadPriority(int priority) {
thread.setPriority(priority);
}
void start() {
isListening = true;
// final Thread thread = new Thread(this);
// // The JVM exits when the only threads running are all daemon threads.
thread.setDaemon(true);
thread.setPriority(Thread.NORM_PRIORITY);
thread.start();
// Log.d(TAG,"create thread : "+thread.getId());
}
void stop() {
isListening = false;
}
private void handleRead(SelectionKey key) {
// Log.d("MIDIPort2","handleRead");
DatagramChannel c = (DatagramChannel) key.channel();
UDPBuffer b = (UDPBuffer) key.attachment();
try {
b.buffer.clear();
b.socketAddress = c.receive(b.buffer); | // Path: midi/src/main/java/com/disappointedpig/midi/internal_events/PacketEvent.java
// public class PacketEvent {
// private InetAddress address;
// private int port;
// private byte[] data;
// private int length;
// public PacketEvent(final DatagramPacket packet) {
// address = packet.getAddress();
// port = packet.getPort();
// data = packet.getData();
// length = packet.getLength();
// // Log.d("PacketEvent"," p:"+packet.getLength()+ " d:"+data.length);
// }
//
// public Bundle getRInfo() {
// Bundle rinfo = new Bundle();
// rinfo.putString(com.disappointedpig.midi.MIDIConstants.RINFO_ADDR,address.getHostAddress());
// rinfo.putInt(MIDIConstants.RINFO_PORT,port);
// return rinfo;
// }
//
// public InetAddress getAddress() {
// return address;
// }
//
// public int getPort() {
// return port;
// }
//
// public byte[] getData() {
// return data;
// }
//
// public int getLength() {
// return data.length;
// }
// }
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIPort.java
import android.os.Bundle;
import android.util.Log;
import com.disappointedpig.midi.internal_events.PacketEvent;
import org.greenrobot.eventbus.EventBus;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.Iterator;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
return thread.getPriority();
}
void setThreadPriority(int priority) {
thread.setPriority(priority);
}
void start() {
isListening = true;
// final Thread thread = new Thread(this);
// // The JVM exits when the only threads running are all daemon threads.
thread.setDaemon(true);
thread.setPriority(Thread.NORM_PRIORITY);
thread.start();
// Log.d(TAG,"create thread : "+thread.getId());
}
void stop() {
isListening = false;
}
private void handleRead(SelectionKey key) {
// Log.d("MIDIPort2","handleRead");
DatagramChannel c = (DatagramChannel) key.channel();
UDPBuffer b = (UDPBuffer) key.attachment();
try {
b.buffer.clear();
b.socketAddress = c.receive(b.buffer); | EventBus.getDefault().post(new PacketEvent(new DatagramPacket(b.buffer.array(),b.buffer.capacity(),b.socketAddress))); |
DisappointedPig/DPMIDI | midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
| import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON; | package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) { | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java
import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON;
package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) { | address = rinfo.getString(RINFO_ADDR,""); |
DisappointedPig/DPMIDI | midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
| import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON; | package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) {
address = rinfo.getString(RINFO_ADDR,""); | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java
import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON;
package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) {
address = rinfo.getString(RINFO_ADDR,""); | port = rinfo.getInt(RINFO_PORT); |
DisappointedPig/DPMIDI | midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
| import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON; | package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) {
address = rinfo.getString(RINFO_ADDR,"");
port = rinfo.getInt(RINFO_PORT); | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java
import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON;
package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) {
address = rinfo.getString(RINFO_ADDR,"");
port = rinfo.getInt(RINFO_PORT); | name = rinfo.getString(RINFO_NAME,""); |
DisappointedPig/DPMIDI | midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
| import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON; | package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) {
address = rinfo.getString(RINFO_ADDR,"");
port = rinfo.getInt(RINFO_PORT);
name = rinfo.getString(RINFO_NAME,""); | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_ADDR = "address";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_NAME = "name";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_PORT = "port";
//
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public static final String RINFO_RECON = "reconnect";
// Path: midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java
import android.os.Bundle;
import static com.disappointedpig.midi.MIDIConstants.RINFO_ADDR;
import static com.disappointedpig.midi.MIDIConstants.RINFO_NAME;
import static com.disappointedpig.midi.MIDIConstants.RINFO_PORT;
import static com.disappointedpig.midi.MIDIConstants.RINFO_RECON;
package com.disappointedpig.midi;
public class MIDIAddressBookEntry {
private String address;
private int port;
private String name;
private Boolean reconnect;
public MIDIAddressBookEntry() {
}
public MIDIAddressBookEntry(Bundle rinfo) {
address = rinfo.getString(RINFO_ADDR,"");
port = rinfo.getInt(RINFO_PORT);
name = rinfo.getString(RINFO_NAME,""); | reconnect = rinfo.getBoolean(RINFO_RECON,false); |
DisappointedPig/DPMIDI | app/src/main/java/com/disappointedpig/dpmidi/AddressBookEvent.java | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java
// public class MIDIAddressBookEntry {
//
// private String address;
// private int port;
// private String name;
// private Boolean reconnect;
//
// public MIDIAddressBookEntry() {
// }
//
// public MIDIAddressBookEntry(Bundle rinfo) {
// address = rinfo.getString(RINFO_ADDR,"");
// port = rinfo.getInt(RINFO_PORT);
// name = rinfo.getString(RINFO_NAME,"");
// reconnect = rinfo.getBoolean(RINFO_RECON,false);
// }
//
// public Bundle rinfo() {
// Bundle rinfo = new Bundle();
// rinfo.putString(RINFO_NAME,name);
// rinfo.putString(RINFO_ADDR,address);
// rinfo.putInt(RINFO_PORT,port);
// rinfo.putBoolean(RINFO_RECON,reconnect);
// return rinfo;
// }
//
// public void setAddress(String a) {
// address = a;
// }
//
// public String getAddress() {
// return address;
// }
//
// public void setPort(int p) {
// port = p;
// }
//
// public int getPort() {
// return port;
// }
//
// public String getAddressPort() { return address+":"+port; }
//
// public void setName(String n) {
// name = n;
// }
//
// public String getName() {
// return name;
// }
//
// public void setReconnect(boolean b) {
// reconnect = b;
// }
//
// public boolean getReconnect() {
// return reconnect;
// }
//
// }
| import com.disappointedpig.midi.MIDIAddressBookEntry; | package com.disappointedpig.dpmidi;
public class AddressBookEvent {
AddressBookEventType type; | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIAddressBookEntry.java
// public class MIDIAddressBookEntry {
//
// private String address;
// private int port;
// private String name;
// private Boolean reconnect;
//
// public MIDIAddressBookEntry() {
// }
//
// public MIDIAddressBookEntry(Bundle rinfo) {
// address = rinfo.getString(RINFO_ADDR,"");
// port = rinfo.getInt(RINFO_PORT);
// name = rinfo.getString(RINFO_NAME,"");
// reconnect = rinfo.getBoolean(RINFO_RECON,false);
// }
//
// public Bundle rinfo() {
// Bundle rinfo = new Bundle();
// rinfo.putString(RINFO_NAME,name);
// rinfo.putString(RINFO_ADDR,address);
// rinfo.putInt(RINFO_PORT,port);
// rinfo.putBoolean(RINFO_RECON,reconnect);
// return rinfo;
// }
//
// public void setAddress(String a) {
// address = a;
// }
//
// public String getAddress() {
// return address;
// }
//
// public void setPort(int p) {
// port = p;
// }
//
// public int getPort() {
// return port;
// }
//
// public String getAddressPort() { return address+":"+port; }
//
// public void setName(String n) {
// name = n;
// }
//
// public String getName() {
// return name;
// }
//
// public void setReconnect(boolean b) {
// reconnect = b;
// }
//
// public boolean getReconnect() {
// return reconnect;
// }
//
// }
// Path: app/src/main/java/com/disappointedpig/dpmidi/AddressBookEvent.java
import com.disappointedpig.midi.MIDIAddressBookEntry;
package com.disappointedpig.dpmidi;
public class AddressBookEvent {
AddressBookEventType type; | MIDIAddressBookEntry entry; |
DisappointedPig/DPMIDI | midi/src/main/java/com/disappointedpig/midi/internal_events/PacketEvent.java | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public final class MIDIConstants {
// public static final String RINFO_NAME = "name";
// public static final String RINFO_PORT = "port";
// public static final String RINFO_ADDR = "address";
// public static final String RINFO_RECON = "reconnect";
// public static final String RINFO_FAIL = "failed";
//
// public static final String MSG_COMMAND = "command";
// public static final String MSG_CHANNEL = "channel";
// public static final String MSG_NOTE = "note";
// public static final String MSG_VELOCITY = "velocity";
// }
| import android.os.Bundle;
import com.disappointedpig.midi.MIDIConstants;
import java.net.DatagramPacket;
import java.net.InetAddress; | package com.disappointedpig.midi.internal_events;
public class PacketEvent {
private InetAddress address;
private int port;
private byte[] data;
private int length;
public PacketEvent(final DatagramPacket packet) {
address = packet.getAddress();
port = packet.getPort();
data = packet.getData();
length = packet.getLength();
// Log.d("PacketEvent"," p:"+packet.getLength()+ " d:"+data.length);
}
public Bundle getRInfo() {
Bundle rinfo = new Bundle(); | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIConstants.java
// public final class MIDIConstants {
// public static final String RINFO_NAME = "name";
// public static final String RINFO_PORT = "port";
// public static final String RINFO_ADDR = "address";
// public static final String RINFO_RECON = "reconnect";
// public static final String RINFO_FAIL = "failed";
//
// public static final String MSG_COMMAND = "command";
// public static final String MSG_CHANNEL = "channel";
// public static final String MSG_NOTE = "note";
// public static final String MSG_VELOCITY = "velocity";
// }
// Path: midi/src/main/java/com/disappointedpig/midi/internal_events/PacketEvent.java
import android.os.Bundle;
import com.disappointedpig.midi.MIDIConstants;
import java.net.DatagramPacket;
import java.net.InetAddress;
package com.disappointedpig.midi.internal_events;
public class PacketEvent {
private InetAddress address;
private int port;
private byte[] data;
private int length;
public PacketEvent(final DatagramPacket packet) {
address = packet.getAddress();
port = packet.getPort();
data = packet.getData();
length = packet.getLength();
// Log.d("PacketEvent"," p:"+packet.getLength()+ " d:"+data.length);
}
public Bundle getRInfo() {
Bundle rinfo = new Bundle(); | rinfo.putString(com.disappointedpig.midi.MIDIConstants.RINFO_ADDR,address.getHostAddress()); |
DisappointedPig/DPMIDI | midi/src/main/java/com/disappointedpig/midi/internal_events/ConnectionFailedEvent.java | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIFailCode.java
// public enum MIDIFailCode {
// UNKNOWN,
// UNABLE_TO_CONNECT,
// CONNECTION_LOST,
// RECON_MAX_TRIES,
// SYNC_FAILURE,
// REJECTED_INVITATION
// }
| import android.os.Bundle;
import com.disappointedpig.midi.MIDIFailCode; | package com.disappointedpig.midi.internal_events;
public class ConnectionFailedEvent {
public final Bundle rinfo; | // Path: midi/src/main/java/com/disappointedpig/midi/MIDIFailCode.java
// public enum MIDIFailCode {
// UNKNOWN,
// UNABLE_TO_CONNECT,
// CONNECTION_LOST,
// RECON_MAX_TRIES,
// SYNC_FAILURE,
// REJECTED_INVITATION
// }
// Path: midi/src/main/java/com/disappointedpig/midi/internal_events/ConnectionFailedEvent.java
import android.os.Bundle;
import com.disappointedpig.midi.MIDIFailCode;
package com.disappointedpig.midi.internal_events;
public class ConnectionFailedEvent {
public final Bundle rinfo; | public final MIDIFailCode code; |
smartcat-labs/berserker | berserker-core/src/test/java/io/smartcat/berserker/LoadGeneratorTest.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
| import java.util.concurrent.atomic.AtomicLong;
import org.junit.Assert;
import org.junit.Test;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator; | package io.smartcat.berserker;
public class LoadGeneratorTest {
private static final long DEFAULT_TEST_TIMEOUT = 3000;
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_terminate_signal_is_sent() {
// GIVEN | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
// Path: berserker-core/src/test/java/io/smartcat/berserker/LoadGeneratorTest.java
import java.util.concurrent.atomic.AtomicLong;
import org.junit.Assert;
import org.junit.Test;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
package io.smartcat.berserker;
public class LoadGeneratorTest {
private static final long DEFAULT_TEST_TIMEOUT = 3000;
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_terminate_signal_is_sent() {
// GIVEN | LoadGenerator<Integer> loadGenerator = new LoadGenerator<>(new RandomIntDataSource(), |
smartcat-labs/berserker | berserker-core/src/test/java/io/smartcat/berserker/LoadGeneratorTest.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
| import java.util.concurrent.atomic.AtomicLong;
import org.junit.Assert;
import org.junit.Test;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator; | package io.smartcat.berserker;
public class LoadGeneratorTest {
private static final long DEFAULT_TEST_TIMEOUT = 3000;
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_terminate_signal_is_sent() {
// GIVEN
LoadGenerator<Integer> loadGenerator = new LoadGenerator<>(new RandomIntDataSource(), | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
// Path: berserker-core/src/test/java/io/smartcat/berserker/LoadGeneratorTest.java
import java.util.concurrent.atomic.AtomicLong;
import org.junit.Assert;
import org.junit.Test;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
package io.smartcat.berserker;
public class LoadGeneratorTest {
private static final long DEFAULT_TEST_TIMEOUT = 3000;
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_terminate_signal_is_sent() {
// GIVEN
LoadGenerator<Integer> loadGenerator = new LoadGenerator<>(new RandomIntDataSource(), | new ConstantRateGenerator(1000), (x) -> { }); |
smartcat-labs/berserker | berserker-core/src/test/java/io/smartcat/berserker/LoadGeneratorTest.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
| import java.util.concurrent.atomic.AtomicLong;
import org.junit.Assert;
import org.junit.Test;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator; | package io.smartcat.berserker;
public class LoadGeneratorTest {
private static final long DEFAULT_TEST_TIMEOUT = 3000;
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_terminate_signal_is_sent() {
// GIVEN
LoadGenerator<Integer> loadGenerator = new LoadGenerator<>(new RandomIntDataSource(),
new ConstantRateGenerator(1000), (x) -> { });
runInBackground(() -> {
// wait a bit for loadGenerator to run
wait(1000);
loadGenerator.terminate();
wait(500);
});
// WHEN
loadGenerator.run();
// THEN
// test finishes without timeout
}
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_dataSource_has_no_next_element() {
// GIVEN | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
// Path: berserker-core/src/test/java/io/smartcat/berserker/LoadGeneratorTest.java
import java.util.concurrent.atomic.AtomicLong;
import org.junit.Assert;
import org.junit.Test;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
package io.smartcat.berserker;
public class LoadGeneratorTest {
private static final long DEFAULT_TEST_TIMEOUT = 3000;
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_terminate_signal_is_sent() {
// GIVEN
LoadGenerator<Integer> loadGenerator = new LoadGenerator<>(new RandomIntDataSource(),
new ConstantRateGenerator(1000), (x) -> { });
runInBackground(() -> {
// wait a bit for loadGenerator to run
wait(1000);
loadGenerator.terminate();
wait(500);
});
// WHEN
loadGenerator.run();
// THEN
// test finishes without timeout
}
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void loadGenerator_should_be_terminated_when_dataSource_has_no_next_element() {
// GIVEN | LoadGenerator<Integer> loadGenerator = new LoadGenerator<>(new DataSource<Integer>() { |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/RateGeneratorProxy.java
// public class RateGeneratorProxy implements RateGenerator {
//
// private RateGenerator delegate;
//
// /**
// * Constructs proxy without delegate.
// */
// public RateGeneratorProxy() {
// }
//
// /**
// * Constructs proxy with specified <code>delegate</code>.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public RateGeneratorProxy(RateGenerator delegate) {
// setDelegate(delegate);
// }
//
// /**
// * Sets value to this proxy.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public void setDelegate(RateGenerator delegate) {
// if (delegate == null) {
// throw new IllegalArgumentException("Delegate cannot be null.");
// }
// this.delegate = delegate;
// }
//
// @Override
// public double getRate(long time) {
// checkDelegate();
// return delegate.getRate(time);
// }
//
// private void checkDelegate() {
// if (delegate == null) {
// throw new DelegateNotSetException();
// }
// }
//
// /**
// * Signals that delegate is not set.
// */
// public static class DelegateNotSetException extends RuntimeException {
//
// private static final long serialVersionUID = 6257779717961934851L;
//
// /**
// * Constructs {@link DelegateNotSetException} with default message.
// */
// public DelegateNotSetException() {
// super("Delegate not set for ValueProxy.");
// }
// }
// }
| import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
import io.smartcat.berserker.rategenerator.RateGeneratorProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map; | package io.smartcat.berserker.configuration.rategenerator;
/**
* Constructs {@link RateGenerator} out of parsed configuration.
*/
public class RateGeneratorConfigurationParser {
private static final String OFFSET = "offset";
private static final String RATES = "rates";
private static final String OUTPUT = "output";
private final Map<String, Object> rates;
private final Object outputExpression; | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/RateGeneratorProxy.java
// public class RateGeneratorProxy implements RateGenerator {
//
// private RateGenerator delegate;
//
// /**
// * Constructs proxy without delegate.
// */
// public RateGeneratorProxy() {
// }
//
// /**
// * Constructs proxy with specified <code>delegate</code>.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public RateGeneratorProxy(RateGenerator delegate) {
// setDelegate(delegate);
// }
//
// /**
// * Sets value to this proxy.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public void setDelegate(RateGenerator delegate) {
// if (delegate == null) {
// throw new IllegalArgumentException("Delegate cannot be null.");
// }
// this.delegate = delegate;
// }
//
// @Override
// public double getRate(long time) {
// checkDelegate();
// return delegate.getRate(time);
// }
//
// private void checkDelegate() {
// if (delegate == null) {
// throw new DelegateNotSetException();
// }
// }
//
// /**
// * Signals that delegate is not set.
// */
// public static class DelegateNotSetException extends RuntimeException {
//
// private static final long serialVersionUID = 6257779717961934851L;
//
// /**
// * Constructs {@link DelegateNotSetException} with default message.
// */
// public DelegateNotSetException() {
// super("Delegate not set for ValueProxy.");
// }
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
import io.smartcat.berserker.rategenerator.RateGeneratorProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map;
package io.smartcat.berserker.configuration.rategenerator;
/**
* Constructs {@link RateGenerator} out of parsed configuration.
*/
public class RateGeneratorConfigurationParser {
private static final String OFFSET = "offset";
private static final String RATES = "rates";
private static final String OUTPUT = "output";
private final Map<String, Object> rates;
private final Object outputExpression; | private Map<String, RateGeneratorProxy> proxyValues; |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/RateGeneratorProxy.java
// public class RateGeneratorProxy implements RateGenerator {
//
// private RateGenerator delegate;
//
// /**
// * Constructs proxy without delegate.
// */
// public RateGeneratorProxy() {
// }
//
// /**
// * Constructs proxy with specified <code>delegate</code>.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public RateGeneratorProxy(RateGenerator delegate) {
// setDelegate(delegate);
// }
//
// /**
// * Sets value to this proxy.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public void setDelegate(RateGenerator delegate) {
// if (delegate == null) {
// throw new IllegalArgumentException("Delegate cannot be null.");
// }
// this.delegate = delegate;
// }
//
// @Override
// public double getRate(long time) {
// checkDelegate();
// return delegate.getRate(time);
// }
//
// private void checkDelegate() {
// if (delegate == null) {
// throw new DelegateNotSetException();
// }
// }
//
// /**
// * Signals that delegate is not set.
// */
// public static class DelegateNotSetException extends RuntimeException {
//
// private static final long serialVersionUID = 6257779717961934851L;
//
// /**
// * Constructs {@link DelegateNotSetException} with default message.
// */
// public DelegateNotSetException() {
// super("Delegate not set for ValueProxy.");
// }
// }
// }
| import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
import io.smartcat.berserker.rategenerator.RateGeneratorProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map; | package io.smartcat.berserker.configuration.rategenerator;
/**
* Constructs {@link RateGenerator} out of parsed configuration.
*/
public class RateGeneratorConfigurationParser {
private static final String OFFSET = "offset";
private static final String RATES = "rates";
private static final String OUTPUT = "output";
private final Map<String, Object> rates;
private final Object outputExpression;
private Map<String, RateGeneratorProxy> proxyValues;
private RateGeneratorExpressionParser parser; | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/RateGeneratorProxy.java
// public class RateGeneratorProxy implements RateGenerator {
//
// private RateGenerator delegate;
//
// /**
// * Constructs proxy without delegate.
// */
// public RateGeneratorProxy() {
// }
//
// /**
// * Constructs proxy with specified <code>delegate</code>.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public RateGeneratorProxy(RateGenerator delegate) {
// setDelegate(delegate);
// }
//
// /**
// * Sets value to this proxy.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public void setDelegate(RateGenerator delegate) {
// if (delegate == null) {
// throw new IllegalArgumentException("Delegate cannot be null.");
// }
// this.delegate = delegate;
// }
//
// @Override
// public double getRate(long time) {
// checkDelegate();
// return delegate.getRate(time);
// }
//
// private void checkDelegate() {
// if (delegate == null) {
// throw new DelegateNotSetException();
// }
// }
//
// /**
// * Signals that delegate is not set.
// */
// public static class DelegateNotSetException extends RuntimeException {
//
// private static final long serialVersionUID = 6257779717961934851L;
//
// /**
// * Constructs {@link DelegateNotSetException} with default message.
// */
// public DelegateNotSetException() {
// super("Delegate not set for ValueProxy.");
// }
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
import io.smartcat.berserker.rategenerator.RateGeneratorProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map;
package io.smartcat.berserker.configuration.rategenerator;
/**
* Constructs {@link RateGenerator} out of parsed configuration.
*/
public class RateGeneratorConfigurationParser {
private static final String OFFSET = "offset";
private static final String RATES = "rates";
private static final String OUTPUT = "output";
private final Map<String, Object> rates;
private final Object outputExpression;
private Map<String, RateGeneratorProxy> proxyValues;
private RateGeneratorExpressionParser parser; | private ReportingParseRunner<RateGenerator> parseRunner; |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/RateGeneratorProxy.java
// public class RateGeneratorProxy implements RateGenerator {
//
// private RateGenerator delegate;
//
// /**
// * Constructs proxy without delegate.
// */
// public RateGeneratorProxy() {
// }
//
// /**
// * Constructs proxy with specified <code>delegate</code>.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public RateGeneratorProxy(RateGenerator delegate) {
// setDelegate(delegate);
// }
//
// /**
// * Sets value to this proxy.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public void setDelegate(RateGenerator delegate) {
// if (delegate == null) {
// throw new IllegalArgumentException("Delegate cannot be null.");
// }
// this.delegate = delegate;
// }
//
// @Override
// public double getRate(long time) {
// checkDelegate();
// return delegate.getRate(time);
// }
//
// private void checkDelegate() {
// if (delegate == null) {
// throw new DelegateNotSetException();
// }
// }
//
// /**
// * Signals that delegate is not set.
// */
// public static class DelegateNotSetException extends RuntimeException {
//
// private static final long serialVersionUID = 6257779717961934851L;
//
// /**
// * Constructs {@link DelegateNotSetException} with default message.
// */
// public DelegateNotSetException() {
// super("Delegate not set for ValueProxy.");
// }
// }
// }
| import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
import io.smartcat.berserker.rategenerator.RateGeneratorProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map; | }
}
private void checkSectionExistence(Map<String, Object> config, String name) {
if (!config.containsKey(name)) {
throw new RuntimeException("Configuration must contain '" + name + "' section.");
}
}
private void createProxies() {
for (Map.Entry<String, Object> entry : rates.entrySet()) {
proxyValues.put(entry.getKey(), new RateGeneratorProxy());
}
}
private void parseRateGenerators() {
for (Map.Entry<String, Object> entry : rates.entrySet()) {
RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
proxy.setDelegate(rateGenerator);
entry.setValue(proxy);
}
}
private RateGenerator parseRateGeneratorExpression(Object def) {
// handle String as expression and all other types as primitives
if (def instanceof String) {
ParsingResult<RateGenerator> result = parseRunner.run((String) def);
return result.valueStack.pop();
} else if (def instanceof Long) { | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/ConstantRateGenerator.java
// public class ConstantRateGenerator implements RateGenerator {
//
// private final double perSecondRate;
//
// /**
// * Constructs rate generator with specified <code>perSecondRate</code>.
// *
// * @param perSecondRate Rate of the rate generator per second, must be positive number.
// */
// public ConstantRateGenerator(double perSecondRate) {
// if (perSecondRate <= 0) {
// throw new IllegalArgumentException("Rate must be positive number.");
// }
// this.perSecondRate = perSecondRate;
// }
//
// @Override
// public double getRate(long time) {
// return perSecondRate;
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/rategenerator/RateGeneratorProxy.java
// public class RateGeneratorProxy implements RateGenerator {
//
// private RateGenerator delegate;
//
// /**
// * Constructs proxy without delegate.
// */
// public RateGeneratorProxy() {
// }
//
// /**
// * Constructs proxy with specified <code>delegate</code>.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public RateGeneratorProxy(RateGenerator delegate) {
// setDelegate(delegate);
// }
//
// /**
// * Sets value to this proxy.
// *
// * @param delegate Value which will be evaluated and cached.
// */
// public void setDelegate(RateGenerator delegate) {
// if (delegate == null) {
// throw new IllegalArgumentException("Delegate cannot be null.");
// }
// this.delegate = delegate;
// }
//
// @Override
// public double getRate(long time) {
// checkDelegate();
// return delegate.getRate(time);
// }
//
// private void checkDelegate() {
// if (delegate == null) {
// throw new DelegateNotSetException();
// }
// }
//
// /**
// * Signals that delegate is not set.
// */
// public static class DelegateNotSetException extends RuntimeException {
//
// private static final long serialVersionUID = 6257779717961934851L;
//
// /**
// * Constructs {@link DelegateNotSetException} with default message.
// */
// public DelegateNotSetException() {
// super("Delegate not set for ValueProxy.");
// }
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.ConstantRateGenerator;
import io.smartcat.berserker.rategenerator.RateGeneratorProxy;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import java.util.HashMap;
import java.util.Map;
}
}
private void checkSectionExistence(Map<String, Object> config, String name) {
if (!config.containsKey(name)) {
throw new RuntimeException("Configuration must contain '" + name + "' section.");
}
}
private void createProxies() {
for (Map.Entry<String, Object> entry : rates.entrySet()) {
proxyValues.put(entry.getKey(), new RateGeneratorProxy());
}
}
private void parseRateGenerators() {
for (Map.Entry<String, Object> entry : rates.entrySet()) {
RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
proxy.setDelegate(rateGenerator);
entry.setValue(proxy);
}
}
private RateGenerator parseRateGeneratorExpression(Object def) {
// handle String as expression and all other types as primitives
if (def instanceof String) {
ParsingResult<RateGenerator> result = parseRunner.run((String) def);
return result.valueStack.pop();
} else if (def instanceof Long) { | return new ConstantRateGenerator((long) def); |
smartcat-labs/berserker | berserker-cassandra/src/main/java/io/smartcat/berserker/cassandra/worker/CassandraWorker.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/Worker.java
// public interface Worker<T> {
//
// /**
// * Accepts message of type {@code <T>} and processes it.
// *
// * @param message Message which will be processed.
// * @param commitSuccess Callback to be invoked when processing is successful.
// * @param commitFailure Callback to be invoked in case of a failure.
// */
// void accept(T message, Runnable commitSuccess, Runnable commitFailure);
// }
//
// Path: berserker-cassandra/src/main/java/io/smartcat/berserker/cassandra/configuration/PreparedStatement.java
// public class PreparedStatement {
//
// private String id;
// private String query;
//
// /**
// * Constructs empty prepared statement.
// */
// public PreparedStatement() {
// }
//
// /**
// * Constructs prepared statement with specified <code>id</code> and <code>query</code>.
// *
// * @param id Statement id.
// * @param query Statement query.
// */
// public PreparedStatement(String id, String query) {
// this.id = id;
// this.query = query;
// }
//
// /**
// * Returns statement's id.
// *
// * @return Statement's id.
// */
// public String getId() {
// return id;
// }
//
// /**
// * Sets statement's id.
// *
// * @param id Id to set.
// */
// public void setId(String id) {
// this.id = id;
// }
//
// /**
// * Returns statement's query.
// *
// * @return Statement's query.
// */
// public String getQuery() {
// return query;
// }
//
// /**
// * Sets statement's query.
// *
// * @param query Query to set.
// */
// public void setQuery(String query) {
// this.query = query;
// }
// }
| import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.datastax.driver.core.*;
import com.datastax.driver.core.Cluster.Builder;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
import io.smartcat.berserker.api.Worker;
import io.smartcat.berserker.cassandra.configuration.PreparedStatement; | package io.smartcat.berserker.cassandra.worker;
/**
* Worker that executes CQL statements on provided Cassandra connection points. It uses DataStax's java driver
* internally.
*/
public class CassandraWorker implements Worker<Map<String, Object>> {
private static final String QUERY = "query";
private static final String VALUES = "values";
private static final String PREPARED_STATEMENT_ID = "preparedStatementId";
private static final String CONSISTENCY_LEVEL = "consistencyLevel";
private final Cluster cluster;
private final Session session;
private final boolean async; | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/Worker.java
// public interface Worker<T> {
//
// /**
// * Accepts message of type {@code <T>} and processes it.
// *
// * @param message Message which will be processed.
// * @param commitSuccess Callback to be invoked when processing is successful.
// * @param commitFailure Callback to be invoked in case of a failure.
// */
// void accept(T message, Runnable commitSuccess, Runnable commitFailure);
// }
//
// Path: berserker-cassandra/src/main/java/io/smartcat/berserker/cassandra/configuration/PreparedStatement.java
// public class PreparedStatement {
//
// private String id;
// private String query;
//
// /**
// * Constructs empty prepared statement.
// */
// public PreparedStatement() {
// }
//
// /**
// * Constructs prepared statement with specified <code>id</code> and <code>query</code>.
// *
// * @param id Statement id.
// * @param query Statement query.
// */
// public PreparedStatement(String id, String query) {
// this.id = id;
// this.query = query;
// }
//
// /**
// * Returns statement's id.
// *
// * @return Statement's id.
// */
// public String getId() {
// return id;
// }
//
// /**
// * Sets statement's id.
// *
// * @param id Id to set.
// */
// public void setId(String id) {
// this.id = id;
// }
//
// /**
// * Returns statement's query.
// *
// * @return Statement's query.
// */
// public String getQuery() {
// return query;
// }
//
// /**
// * Sets statement's query.
// *
// * @param query Query to set.
// */
// public void setQuery(String query) {
// this.query = query;
// }
// }
// Path: berserker-cassandra/src/main/java/io/smartcat/berserker/cassandra/worker/CassandraWorker.java
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.datastax.driver.core.*;
import com.datastax.driver.core.Cluster.Builder;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
import io.smartcat.berserker.api.Worker;
import io.smartcat.berserker.cassandra.configuration.PreparedStatement;
package io.smartcat.berserker.cassandra.worker;
/**
* Worker that executes CQL statements on provided Cassandra connection points. It uses DataStax's java driver
* internally.
*/
public class CassandraWorker implements Worker<Map<String, Object>> {
private static final String QUERY = "query";
private static final String VALUES = "values";
private static final String PREPARED_STATEMENT_ID = "preparedStatementId";
private static final String CONSISTENCY_LEVEL = "consistencyLevel";
private final Cluster cluster;
private final Session session;
private final boolean async; | private final Map<String, com.datastax.driver.core.PreparedStatement> preparedStatements; |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource; | package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource;
package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override | public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException { |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource; | package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
if (!configuration.containsKey(TYPE)) {
throw new ConfigurationParseException("Property '" + TYPE + "' is mandatory.");
}
String type = (String) configuration.get(TYPE);
if (TYPE_INT.equals(type)) { | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource;
package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
if (!configuration.containsKey(TYPE)) {
throw new ConfigurationParseException("Property '" + TYPE + "' is mandatory.");
}
String type = (String) configuration.get(TYPE);
if (TYPE_INT.equals(type)) { | return new RandomIntDataSource(); |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource; | package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
if (!configuration.containsKey(TYPE)) {
throw new ConfigurationParseException("Property '" + TYPE + "' is mandatory.");
}
String type = (String) configuration.get(TYPE);
if (TYPE_INT.equals(type)) {
return new RandomIntDataSource();
} else if (TYPE_LONG.equals(type)) { | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource;
package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
if (!configuration.containsKey(TYPE)) {
throw new ConfigurationParseException("Property '" + TYPE + "' is mandatory.");
}
String type = (String) configuration.get(TYPE);
if (TYPE_INT.equals(type)) {
return new RandomIntDataSource();
} else if (TYPE_LONG.equals(type)) { | return new RandomLongDataSource(); |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource; | package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
if (!configuration.containsKey(TYPE)) {
throw new ConfigurationParseException("Property '" + TYPE + "' is mandatory.");
}
String type = (String) configuration.get(TYPE);
if (TYPE_INT.equals(type)) {
return new RandomIntDataSource();
} else if (TYPE_LONG.equals(type)) {
return new RandomLongDataSource();
} else if (TYPE_DOUBLE.equals(type)) { | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomDoubleDataSource.java
// public class RandomDoubleDataSource implements DataSource<Double> {
//
// private final Iterator<Double> it = new SplittableRandom().doubles().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Double getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomIntDataSource.java
// public class RandomIntDataSource implements DataSource<Integer> {
//
// private final Iterator<Integer> it = new SplittableRandom().ints().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Integer getNext(long time) {
// return it.next();
// }
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/datasource/RandomLongDataSource.java
// public class RandomLongDataSource implements DataSource<Long> {
//
// private final Iterator<Long> it = new SplittableRandom().longs().iterator();
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Long getNext(long time) {
// return it.next();
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/RandomNumberDataSourceConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.datasource.RandomDoubleDataSource;
import io.smartcat.berserker.datasource.RandomIntDataSource;
import io.smartcat.berserker.datasource.RandomLongDataSource;
package io.smartcat.berserker.configuration;
/**
* Configuration to construct one of the following: {@link RandomIntDataSource}, {@link RandomLongDataSource} or
* {@link RandomDoubleDataSource}.
*
* Map needs to contain key '<code>type</code>' and have one of the following values: '<code>int</code>',
* '<code>long</code>', '<code>double</code>'.
*/
public class RandomNumberDataSourceConfiguration implements DataSourceConfiguration {
private static final String TYPE = "type";
private static final String TYPE_INT = "int";
private static final String TYPE_LONG = "long";
private static final String TYPE_DOUBLE = "double";
@Override
public String getName() {
return "RandomDataSource";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
if (!configuration.containsKey(TYPE)) {
throw new ConfigurationParseException("Property '" + TYPE + "' is mandatory.");
}
String type = (String) configuration.get(TYPE);
if (TYPE_INT.equals(type)) {
return new RandomIntDataSource();
} else if (TYPE_LONG.equals(type)) {
return new RandomLongDataSource();
} else if (TYPE_DOUBLE.equals(type)) { | return new RandomDoubleDataSource(); |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/LoadGenerator.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
| import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.api.RateGenerator; | package io.smartcat.berserker;
/**
* Load generator used to execute work tasks with data from provided data source.
*
* @param <T> Type of data which will be used.
*/
public class LoadGenerator<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(LoadGenerator.class);
private static final long NANOS_IN_SECOND = TimeUnit.SECONDS.toNanos(1);
private static final long TICK_PERIOD_IN_NANOS = 1000;
| // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/LoadGenerator.java
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.api.RateGenerator;
package io.smartcat.berserker;
/**
* Load generator used to execute work tasks with data from provided data source.
*
* @param <T> Type of data which will be used.
*/
public class LoadGenerator<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(LoadGenerator.class);
private static final long NANOS_IN_SECOND = TimeUnit.SECONDS.toNanos(1);
private static final long TICK_PERIOD_IN_NANOS = 1000;
| private final DataSource<T> dataSource; |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/LoadGenerator.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
| import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.api.RateGenerator; | package io.smartcat.berserker;
/**
* Load generator used to execute work tasks with data from provided data source.
*
* @param <T> Type of data which will be used.
*/
public class LoadGenerator<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(LoadGenerator.class);
private static final long NANOS_IN_SECOND = TimeUnit.SECONDS.toNanos(1);
private static final long TICK_PERIOD_IN_NANOS = 1000;
private final DataSource<T> dataSource; | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/LoadGenerator.java
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.api.RateGenerator;
package io.smartcat.berserker;
/**
* Load generator used to execute work tasks with data from provided data source.
*
* @param <T> Type of data which will be used.
*/
public class LoadGenerator<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(LoadGenerator.class);
private static final long NANOS_IN_SECOND = TimeUnit.SECONDS.toNanos(1);
private static final long TICK_PERIOD_IN_NANOS = 1000;
private final DataSource<T> dataSource; | private final RateGenerator rateGenerator; |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorExpressionParser.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
| import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.*;
import org.parboiled.BaseParser;
import org.parboiled.Rule;
import org.parboiled.support.Var;
import java.util.Map; | public Rule term() {
Var<Character> op = new Var<>();
return Sequence(factor(), ZeroOrMore(ZeroOrMore(whitespace()), FirstOf("*", "/"), op.set(matchedChar()),
ZeroOrMore(whitespace()), factor(), push(createMultiplicationOrDivisionRateGenerator(op.get()))));
}
/**
* Factor definition.
*
* @return Factor definition rule.
*/
public Rule factor() {
return FirstOf(simpleRateGenerator(), function(rateGenerator()));
}
/**
* Simple rate generator definition.
*
* @return Simple rate generator definition rule.
*/
public Rule simpleRateGenerator() {
return FirstOf(rateGeneratorReference(), functionRateGenerator(), constantRateGenerator());
}
/**
* Returns or creates new value proxy for given name.
*
* @param name Name of the value proxy.
* @return Proxy value.
*/ | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorExpressionParser.java
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.rategenerator.*;
import org.parboiled.BaseParser;
import org.parboiled.Rule;
import org.parboiled.support.Var;
import java.util.Map;
public Rule term() {
Var<Character> op = new Var<>();
return Sequence(factor(), ZeroOrMore(ZeroOrMore(whitespace()), FirstOf("*", "/"), op.set(matchedChar()),
ZeroOrMore(whitespace()), factor(), push(createMultiplicationOrDivisionRateGenerator(op.get()))));
}
/**
* Factor definition.
*
* @return Factor definition rule.
*/
public Rule factor() {
return FirstOf(simpleRateGenerator(), function(rateGenerator()));
}
/**
* Simple rate generator definition.
*
* @return Simple rate generator definition rule.
*/
public Rule simpleRateGenerator() {
return FirstOf(rateGeneratorReference(), functionRateGenerator(), constantRateGenerator());
}
/**
* Returns or creates new value proxy for given name.
*
* @param name Name of the value proxy.
* @return Proxy value.
*/ | protected RateGenerator getRateGeneratorProxy(String name) { |
smartcat-labs/berserker | berserker-ranger/src/main/java/io/smartcat/berserker/ranger/configuration/RangerConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/ConfigurationParseException.java
// public class ConfigurationParseException extends ConfigurationException {
//
// private static final long serialVersionUID = -7101805420460054579L;
//
// /**
// * Default constructor.
// */
// public ConfigurationParseException() {
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// * @param enableSuppression controls exception suppression.
// * @param writableStackTrace stack trace.
// */
// public ConfigurationParseException(String message, Throwable cause, boolean enableSuppression,
// boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// */
// public ConfigurationParseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// */
// public ConfigurationParseException(String message) {
// super(message);
// }
//
// /**
// * Constructor.
// *
// * @param cause Exception cause.
// */
// public ConfigurationParseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/DataSourceConfiguration.java
// public interface DataSourceConfiguration extends BaseConfiguration {
//
// /**
// * Returns data source based on configuration parameters.
// *
// * @param configuration Configuration specific to data source it should construct.
// * @return Instance of {@link DataSource}, never null.
// *
// * @throws ConfigurationParseException If there is an error during configuration parsing.
// */
// DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException;
// }
//
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/datasource/RangerDataSource.java
// public class RangerDataSource implements DataSource<Map<String, Object>> {
//
// private final ObjectGenerator<Map<String, Object>> objectGenerator;
//
// /**
// * Constructs ranger data source with specified <code>aggregatedObjectGenerator</code>.
// *
// * @param objectGenerator Generator which will be used to generate objects.
// */
// public RangerDataSource(ObjectGenerator<Map<String, Object>> objectGenerator) {
// this.objectGenerator = objectGenerator;
// }
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Map<String, Object> getNext(long time) {
// return (Map<String, Object>) objectGenerator.next();
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.configuration.ConfigurationParseException;
import io.smartcat.berserker.configuration.DataSourceConfiguration;
import io.smartcat.berserker.ranger.datasource.RangerDataSource;
import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.parser.ConfigurationParser; | package io.smartcat.berserker.ranger.configuration;
/**
* Configuration to construct {@link RangerDataSource}.
*/
public class RangerConfiguration implements DataSourceConfiguration {
@Override
public String getName() {
return "Ranger";
}
@Override | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/ConfigurationParseException.java
// public class ConfigurationParseException extends ConfigurationException {
//
// private static final long serialVersionUID = -7101805420460054579L;
//
// /**
// * Default constructor.
// */
// public ConfigurationParseException() {
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// * @param enableSuppression controls exception suppression.
// * @param writableStackTrace stack trace.
// */
// public ConfigurationParseException(String message, Throwable cause, boolean enableSuppression,
// boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// */
// public ConfigurationParseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// */
// public ConfigurationParseException(String message) {
// super(message);
// }
//
// /**
// * Constructor.
// *
// * @param cause Exception cause.
// */
// public ConfigurationParseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/DataSourceConfiguration.java
// public interface DataSourceConfiguration extends BaseConfiguration {
//
// /**
// * Returns data source based on configuration parameters.
// *
// * @param configuration Configuration specific to data source it should construct.
// * @return Instance of {@link DataSource}, never null.
// *
// * @throws ConfigurationParseException If there is an error during configuration parsing.
// */
// DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException;
// }
//
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/datasource/RangerDataSource.java
// public class RangerDataSource implements DataSource<Map<String, Object>> {
//
// private final ObjectGenerator<Map<String, Object>> objectGenerator;
//
// /**
// * Constructs ranger data source with specified <code>aggregatedObjectGenerator</code>.
// *
// * @param objectGenerator Generator which will be used to generate objects.
// */
// public RangerDataSource(ObjectGenerator<Map<String, Object>> objectGenerator) {
// this.objectGenerator = objectGenerator;
// }
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Map<String, Object> getNext(long time) {
// return (Map<String, Object>) objectGenerator.next();
// }
// }
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/configuration/RangerConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.configuration.ConfigurationParseException;
import io.smartcat.berserker.configuration.DataSourceConfiguration;
import io.smartcat.berserker.ranger.datasource.RangerDataSource;
import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.parser.ConfigurationParser;
package io.smartcat.berserker.ranger.configuration;
/**
* Configuration to construct {@link RangerDataSource}.
*/
public class RangerConfiguration implements DataSourceConfiguration {
@Override
public String getName() {
return "Ranger";
}
@Override | public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException { |
smartcat-labs/berserker | berserker-ranger/src/main/java/io/smartcat/berserker/ranger/configuration/RangerConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/ConfigurationParseException.java
// public class ConfigurationParseException extends ConfigurationException {
//
// private static final long serialVersionUID = -7101805420460054579L;
//
// /**
// * Default constructor.
// */
// public ConfigurationParseException() {
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// * @param enableSuppression controls exception suppression.
// * @param writableStackTrace stack trace.
// */
// public ConfigurationParseException(String message, Throwable cause, boolean enableSuppression,
// boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// */
// public ConfigurationParseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// */
// public ConfigurationParseException(String message) {
// super(message);
// }
//
// /**
// * Constructor.
// *
// * @param cause Exception cause.
// */
// public ConfigurationParseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/DataSourceConfiguration.java
// public interface DataSourceConfiguration extends BaseConfiguration {
//
// /**
// * Returns data source based on configuration parameters.
// *
// * @param configuration Configuration specific to data source it should construct.
// * @return Instance of {@link DataSource}, never null.
// *
// * @throws ConfigurationParseException If there is an error during configuration parsing.
// */
// DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException;
// }
//
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/datasource/RangerDataSource.java
// public class RangerDataSource implements DataSource<Map<String, Object>> {
//
// private final ObjectGenerator<Map<String, Object>> objectGenerator;
//
// /**
// * Constructs ranger data source with specified <code>aggregatedObjectGenerator</code>.
// *
// * @param objectGenerator Generator which will be used to generate objects.
// */
// public RangerDataSource(ObjectGenerator<Map<String, Object>> objectGenerator) {
// this.objectGenerator = objectGenerator;
// }
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Map<String, Object> getNext(long time) {
// return (Map<String, Object>) objectGenerator.next();
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.configuration.ConfigurationParseException;
import io.smartcat.berserker.configuration.DataSourceConfiguration;
import io.smartcat.berserker.ranger.datasource.RangerDataSource;
import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.parser.ConfigurationParser; | package io.smartcat.berserker.ranger.configuration;
/**
* Configuration to construct {@link RangerDataSource}.
*/
public class RangerConfiguration implements DataSourceConfiguration {
@Override
public String getName() {
return "Ranger";
}
@Override | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/ConfigurationParseException.java
// public class ConfigurationParseException extends ConfigurationException {
//
// private static final long serialVersionUID = -7101805420460054579L;
//
// /**
// * Default constructor.
// */
// public ConfigurationParseException() {
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// * @param enableSuppression controls exception suppression.
// * @param writableStackTrace stack trace.
// */
// public ConfigurationParseException(String message, Throwable cause, boolean enableSuppression,
// boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// */
// public ConfigurationParseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// */
// public ConfigurationParseException(String message) {
// super(message);
// }
//
// /**
// * Constructor.
// *
// * @param cause Exception cause.
// */
// public ConfigurationParseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/DataSourceConfiguration.java
// public interface DataSourceConfiguration extends BaseConfiguration {
//
// /**
// * Returns data source based on configuration parameters.
// *
// * @param configuration Configuration specific to data source it should construct.
// * @return Instance of {@link DataSource}, never null.
// *
// * @throws ConfigurationParseException If there is an error during configuration parsing.
// */
// DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException;
// }
//
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/datasource/RangerDataSource.java
// public class RangerDataSource implements DataSource<Map<String, Object>> {
//
// private final ObjectGenerator<Map<String, Object>> objectGenerator;
//
// /**
// * Constructs ranger data source with specified <code>aggregatedObjectGenerator</code>.
// *
// * @param objectGenerator Generator which will be used to generate objects.
// */
// public RangerDataSource(ObjectGenerator<Map<String, Object>> objectGenerator) {
// this.objectGenerator = objectGenerator;
// }
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Map<String, Object> getNext(long time) {
// return (Map<String, Object>) objectGenerator.next();
// }
// }
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/configuration/RangerConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.configuration.ConfigurationParseException;
import io.smartcat.berserker.configuration.DataSourceConfiguration;
import io.smartcat.berserker.ranger.datasource.RangerDataSource;
import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.parser.ConfigurationParser;
package io.smartcat.berserker.ranger.configuration;
/**
* Configuration to construct {@link RangerDataSource}.
*/
public class RangerConfiguration implements DataSourceConfiguration {
@Override
public String getName() {
return "Ranger";
}
@Override | public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException { |
smartcat-labs/berserker | berserker-ranger/src/main/java/io/smartcat/berserker/ranger/configuration/RangerConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/ConfigurationParseException.java
// public class ConfigurationParseException extends ConfigurationException {
//
// private static final long serialVersionUID = -7101805420460054579L;
//
// /**
// * Default constructor.
// */
// public ConfigurationParseException() {
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// * @param enableSuppression controls exception suppression.
// * @param writableStackTrace stack trace.
// */
// public ConfigurationParseException(String message, Throwable cause, boolean enableSuppression,
// boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// */
// public ConfigurationParseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// */
// public ConfigurationParseException(String message) {
// super(message);
// }
//
// /**
// * Constructor.
// *
// * @param cause Exception cause.
// */
// public ConfigurationParseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/DataSourceConfiguration.java
// public interface DataSourceConfiguration extends BaseConfiguration {
//
// /**
// * Returns data source based on configuration parameters.
// *
// * @param configuration Configuration specific to data source it should construct.
// * @return Instance of {@link DataSource}, never null.
// *
// * @throws ConfigurationParseException If there is an error during configuration parsing.
// */
// DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException;
// }
//
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/datasource/RangerDataSource.java
// public class RangerDataSource implements DataSource<Map<String, Object>> {
//
// private final ObjectGenerator<Map<String, Object>> objectGenerator;
//
// /**
// * Constructs ranger data source with specified <code>aggregatedObjectGenerator</code>.
// *
// * @param objectGenerator Generator which will be used to generate objects.
// */
// public RangerDataSource(ObjectGenerator<Map<String, Object>> objectGenerator) {
// this.objectGenerator = objectGenerator;
// }
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Map<String, Object> getNext(long time) {
// return (Map<String, Object>) objectGenerator.next();
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.configuration.ConfigurationParseException;
import io.smartcat.berserker.configuration.DataSourceConfiguration;
import io.smartcat.berserker.ranger.datasource.RangerDataSource;
import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.parser.ConfigurationParser; | package io.smartcat.berserker.ranger.configuration;
/**
* Configuration to construct {@link RangerDataSource}.
*/
public class RangerConfiguration implements DataSourceConfiguration {
@Override
public String getName() {
return "Ranger";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
ObjectGenerator<Map<String, Object>> objectGenerator = new ConfigurationParser(configuration).build(); | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
//
// /**
// * Returns true if data source can provide next value, otherwise false.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return True if data source can provide next value, otherwise false.
// */
// boolean hasNext(long time);
//
// /**
// * Returns next value from this data source.
// *
// * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
// * dependent data source which can then return data with time stamps and/or data influenced by time in
// * any other way.
// * @return Next value from this data source.
// */
// T getNext(long time);
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/ConfigurationParseException.java
// public class ConfigurationParseException extends ConfigurationException {
//
// private static final long serialVersionUID = -7101805420460054579L;
//
// /**
// * Default constructor.
// */
// public ConfigurationParseException() {
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// * @param enableSuppression controls exception suppression.
// * @param writableStackTrace stack trace.
// */
// public ConfigurationParseException(String message, Throwable cause, boolean enableSuppression,
// boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// * @param cause Exception cause.
// */
// public ConfigurationParseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// /**
// * Constructor.
// *
// * @param message Error message.
// */
// public ConfigurationParseException(String message) {
// super(message);
// }
//
// /**
// * Constructor.
// *
// * @param cause Exception cause.
// */
// public ConfigurationParseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: berserker-commons/src/main/java/io/smartcat/berserker/configuration/DataSourceConfiguration.java
// public interface DataSourceConfiguration extends BaseConfiguration {
//
// /**
// * Returns data source based on configuration parameters.
// *
// * @param configuration Configuration specific to data source it should construct.
// * @return Instance of {@link DataSource}, never null.
// *
// * @throws ConfigurationParseException If there is an error during configuration parsing.
// */
// DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException;
// }
//
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/datasource/RangerDataSource.java
// public class RangerDataSource implements DataSource<Map<String, Object>> {
//
// private final ObjectGenerator<Map<String, Object>> objectGenerator;
//
// /**
// * Constructs ranger data source with specified <code>aggregatedObjectGenerator</code>.
// *
// * @param objectGenerator Generator which will be used to generate objects.
// */
// public RangerDataSource(ObjectGenerator<Map<String, Object>> objectGenerator) {
// this.objectGenerator = objectGenerator;
// }
//
// @Override
// public boolean hasNext(long time) {
// return true;
// }
//
// @Override
// public Map<String, Object> getNext(long time) {
// return (Map<String, Object>) objectGenerator.next();
// }
// }
// Path: berserker-ranger/src/main/java/io/smartcat/berserker/ranger/configuration/RangerConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.configuration.ConfigurationParseException;
import io.smartcat.berserker.configuration.DataSourceConfiguration;
import io.smartcat.berserker.ranger.datasource.RangerDataSource;
import io.smartcat.ranger.ObjectGenerator;
import io.smartcat.ranger.parser.ConfigurationParser;
package io.smartcat.berserker.ranger.configuration;
/**
* Configuration to construct {@link RangerDataSource}.
*/
public class RangerConfiguration implements DataSourceConfiguration {
@Override
public String getName() {
return "Ranger";
}
@Override
public DataSource<?> getDataSource(Map<String, Object> configuration) throws ConfigurationParseException {
ObjectGenerator<Map<String, Object>> objectGenerator = new ConfigurationParser(configuration).build(); | return new RangerDataSource(objectGenerator); |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/DefaultRateGeneratorConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
// public class RateGeneratorConfigurationParser {
//
// private static final String OFFSET = "offset";
// private static final String RATES = "rates";
// private static final String OUTPUT = "output";
//
// private final Map<String, Object> rates;
// private final Object outputExpression;
// private Map<String, RateGeneratorProxy> proxyValues;
// private RateGeneratorExpressionParser parser;
// private ReportingParseRunner<RateGenerator> parseRunner;
//
// /**
// * Constructs rate generator configuration parser with specified configuration.
// *
// * @param config Configuration to parse.
// */
// @SuppressWarnings("unchecked")
// public RateGeneratorConfigurationParser(Map<String, Object> config) {
// checkSectionExistence(config, RATES);
// checkSectionExistence(config, OUTPUT);
// this.rates = (Map<String, Object>) config.get(RATES);
// this.outputExpression = config.get(OUTPUT);
// }
//
// /**
// * Creates an instance of {@link RateGenerator} based on provided configuration.
// *
// * @return An instance of {@link RateGenerator}.
// */
// @SuppressWarnings({ "unchecked" })
// public RateGenerator build() {
// buildModel();
// return parseRateGeneratorExpression(outputExpression);
// }
//
// private void buildModel() {
// this.proxyValues = new HashMap<>();
// this.parser = Parboiled.createParser(RateGeneratorExpressionParser.class, proxyValues);
// this.parseRunner = new ReportingParseRunner<>(parser.rateGenerator());
// if (rates != null) {
// createProxies();
// parseRateGenerators();
// }
// }
//
// private void checkSectionExistence(Map<String, Object> config, String name) {
// if (!config.containsKey(name)) {
// throw new RuntimeException("Configuration must contain '" + name + "' section.");
// }
// }
//
// private void createProxies() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// proxyValues.put(entry.getKey(), new RateGeneratorProxy());
// }
// }
//
// private void parseRateGenerators() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
// RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
// proxy.setDelegate(rateGenerator);
// entry.setValue(proxy);
// }
// }
//
// private RateGenerator parseRateGeneratorExpression(Object def) {
// // handle String as expression and all other types as primitives
// if (def instanceof String) {
// ParsingResult<RateGenerator> result = parseRunner.run((String) def);
// return result.valueStack.pop();
// } else if (def instanceof Long) {
// return new ConstantRateGenerator((long) def);
// } else if (def instanceof Integer) {
// return new ConstantRateGenerator(((Number) def).longValue());
// } else {
// throw new RuntimeException("Object type not supported: " + def.getClass().getName());
// }
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.configuration.rategenerator.RateGeneratorConfigurationParser; | package io.smartcat.berserker.configuration;
/**
* Configuration to construct rate generator out of rate generator expressions.
*/
public class DefaultRateGeneratorConfiguration implements RateGeneratorConfiguration {
@Override
public String getName() {
return "default";
}
@Override | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
// public class RateGeneratorConfigurationParser {
//
// private static final String OFFSET = "offset";
// private static final String RATES = "rates";
// private static final String OUTPUT = "output";
//
// private final Map<String, Object> rates;
// private final Object outputExpression;
// private Map<String, RateGeneratorProxy> proxyValues;
// private RateGeneratorExpressionParser parser;
// private ReportingParseRunner<RateGenerator> parseRunner;
//
// /**
// * Constructs rate generator configuration parser with specified configuration.
// *
// * @param config Configuration to parse.
// */
// @SuppressWarnings("unchecked")
// public RateGeneratorConfigurationParser(Map<String, Object> config) {
// checkSectionExistence(config, RATES);
// checkSectionExistence(config, OUTPUT);
// this.rates = (Map<String, Object>) config.get(RATES);
// this.outputExpression = config.get(OUTPUT);
// }
//
// /**
// * Creates an instance of {@link RateGenerator} based on provided configuration.
// *
// * @return An instance of {@link RateGenerator}.
// */
// @SuppressWarnings({ "unchecked" })
// public RateGenerator build() {
// buildModel();
// return parseRateGeneratorExpression(outputExpression);
// }
//
// private void buildModel() {
// this.proxyValues = new HashMap<>();
// this.parser = Parboiled.createParser(RateGeneratorExpressionParser.class, proxyValues);
// this.parseRunner = new ReportingParseRunner<>(parser.rateGenerator());
// if (rates != null) {
// createProxies();
// parseRateGenerators();
// }
// }
//
// private void checkSectionExistence(Map<String, Object> config, String name) {
// if (!config.containsKey(name)) {
// throw new RuntimeException("Configuration must contain '" + name + "' section.");
// }
// }
//
// private void createProxies() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// proxyValues.put(entry.getKey(), new RateGeneratorProxy());
// }
// }
//
// private void parseRateGenerators() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
// RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
// proxy.setDelegate(rateGenerator);
// entry.setValue(proxy);
// }
// }
//
// private RateGenerator parseRateGeneratorExpression(Object def) {
// // handle String as expression and all other types as primitives
// if (def instanceof String) {
// ParsingResult<RateGenerator> result = parseRunner.run((String) def);
// return result.valueStack.pop();
// } else if (def instanceof Long) {
// return new ConstantRateGenerator((long) def);
// } else if (def instanceof Integer) {
// return new ConstantRateGenerator(((Number) def).longValue());
// } else {
// throw new RuntimeException("Object type not supported: " + def.getClass().getName());
// }
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/DefaultRateGeneratorConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.configuration.rategenerator.RateGeneratorConfigurationParser;
package io.smartcat.berserker.configuration;
/**
* Configuration to construct rate generator out of rate generator expressions.
*/
public class DefaultRateGeneratorConfiguration implements RateGeneratorConfiguration {
@Override
public String getName() {
return "default";
}
@Override | public RateGenerator getRateGenerator(Map<String, Object> configuration) throws ConfigurationParseException { |
smartcat-labs/berserker | berserker-core/src/main/java/io/smartcat/berserker/configuration/DefaultRateGeneratorConfiguration.java | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
// public class RateGeneratorConfigurationParser {
//
// private static final String OFFSET = "offset";
// private static final String RATES = "rates";
// private static final String OUTPUT = "output";
//
// private final Map<String, Object> rates;
// private final Object outputExpression;
// private Map<String, RateGeneratorProxy> proxyValues;
// private RateGeneratorExpressionParser parser;
// private ReportingParseRunner<RateGenerator> parseRunner;
//
// /**
// * Constructs rate generator configuration parser with specified configuration.
// *
// * @param config Configuration to parse.
// */
// @SuppressWarnings("unchecked")
// public RateGeneratorConfigurationParser(Map<String, Object> config) {
// checkSectionExistence(config, RATES);
// checkSectionExistence(config, OUTPUT);
// this.rates = (Map<String, Object>) config.get(RATES);
// this.outputExpression = config.get(OUTPUT);
// }
//
// /**
// * Creates an instance of {@link RateGenerator} based on provided configuration.
// *
// * @return An instance of {@link RateGenerator}.
// */
// @SuppressWarnings({ "unchecked" })
// public RateGenerator build() {
// buildModel();
// return parseRateGeneratorExpression(outputExpression);
// }
//
// private void buildModel() {
// this.proxyValues = new HashMap<>();
// this.parser = Parboiled.createParser(RateGeneratorExpressionParser.class, proxyValues);
// this.parseRunner = new ReportingParseRunner<>(parser.rateGenerator());
// if (rates != null) {
// createProxies();
// parseRateGenerators();
// }
// }
//
// private void checkSectionExistence(Map<String, Object> config, String name) {
// if (!config.containsKey(name)) {
// throw new RuntimeException("Configuration must contain '" + name + "' section.");
// }
// }
//
// private void createProxies() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// proxyValues.put(entry.getKey(), new RateGeneratorProxy());
// }
// }
//
// private void parseRateGenerators() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
// RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
// proxy.setDelegate(rateGenerator);
// entry.setValue(proxy);
// }
// }
//
// private RateGenerator parseRateGeneratorExpression(Object def) {
// // handle String as expression and all other types as primitives
// if (def instanceof String) {
// ParsingResult<RateGenerator> result = parseRunner.run((String) def);
// return result.valueStack.pop();
// } else if (def instanceof Long) {
// return new ConstantRateGenerator((long) def);
// } else if (def instanceof Integer) {
// return new ConstantRateGenerator(((Number) def).longValue());
// } else {
// throw new RuntimeException("Object type not supported: " + def.getClass().getName());
// }
// }
// }
| import java.util.Map;
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.configuration.rategenerator.RateGeneratorConfigurationParser; | package io.smartcat.berserker.configuration;
/**
* Configuration to construct rate generator out of rate generator expressions.
*/
public class DefaultRateGeneratorConfiguration implements RateGeneratorConfiguration {
@Override
public String getName() {
return "default";
}
@Override
public RateGenerator getRateGenerator(Map<String, Object> configuration) throws ConfigurationParseException { | // Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
//
// /**
// * Returns rate per second as a function of time.
// *
// * @param time Relative time in nanoseconds from starting load generator.
// * @return Rate per second as a function of time.
// */
// double getRate(long time);
// }
//
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
// public class RateGeneratorConfigurationParser {
//
// private static final String OFFSET = "offset";
// private static final String RATES = "rates";
// private static final String OUTPUT = "output";
//
// private final Map<String, Object> rates;
// private final Object outputExpression;
// private Map<String, RateGeneratorProxy> proxyValues;
// private RateGeneratorExpressionParser parser;
// private ReportingParseRunner<RateGenerator> parseRunner;
//
// /**
// * Constructs rate generator configuration parser with specified configuration.
// *
// * @param config Configuration to parse.
// */
// @SuppressWarnings("unchecked")
// public RateGeneratorConfigurationParser(Map<String, Object> config) {
// checkSectionExistence(config, RATES);
// checkSectionExistence(config, OUTPUT);
// this.rates = (Map<String, Object>) config.get(RATES);
// this.outputExpression = config.get(OUTPUT);
// }
//
// /**
// * Creates an instance of {@link RateGenerator} based on provided configuration.
// *
// * @return An instance of {@link RateGenerator}.
// */
// @SuppressWarnings({ "unchecked" })
// public RateGenerator build() {
// buildModel();
// return parseRateGeneratorExpression(outputExpression);
// }
//
// private void buildModel() {
// this.proxyValues = new HashMap<>();
// this.parser = Parboiled.createParser(RateGeneratorExpressionParser.class, proxyValues);
// this.parseRunner = new ReportingParseRunner<>(parser.rateGenerator());
// if (rates != null) {
// createProxies();
// parseRateGenerators();
// }
// }
//
// private void checkSectionExistence(Map<String, Object> config, String name) {
// if (!config.containsKey(name)) {
// throw new RuntimeException("Configuration must contain '" + name + "' section.");
// }
// }
//
// private void createProxies() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// proxyValues.put(entry.getKey(), new RateGeneratorProxy());
// }
// }
//
// private void parseRateGenerators() {
// for (Map.Entry<String, Object> entry : rates.entrySet()) {
// RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
// RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
// proxy.setDelegate(rateGenerator);
// entry.setValue(proxy);
// }
// }
//
// private RateGenerator parseRateGeneratorExpression(Object def) {
// // handle String as expression and all other types as primitives
// if (def instanceof String) {
// ParsingResult<RateGenerator> result = parseRunner.run((String) def);
// return result.valueStack.pop();
// } else if (def instanceof Long) {
// return new ConstantRateGenerator((long) def);
// } else if (def instanceof Integer) {
// return new ConstantRateGenerator(((Number) def).longValue());
// } else {
// throw new RuntimeException("Object type not supported: " + def.getClass().getName());
// }
// }
// }
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/DefaultRateGeneratorConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.configuration.rategenerator.RateGeneratorConfigurationParser;
package io.smartcat.berserker.configuration;
/**
* Configuration to construct rate generator out of rate generator expressions.
*/
public class DefaultRateGeneratorConfiguration implements RateGeneratorConfiguration {
@Override
public String getName() {
return "default";
}
@Override
public RateGenerator getRateGenerator(Map<String, Object> configuration) throws ConfigurationParseException { | RateGeneratorConfigurationParser parser = new RateGeneratorConfigurationParser(configuration); |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/StructuralTypePriorityExpansionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 16-Sep-2008<br><br>
*/
public class StructuralTypePriorityExpansionStrategy implements ExpansionStrategy {
private int count = 0;
private InitialEntailmentCheckStrategy initialEntailmentCheckStrategy = InitialEntailmentCheckStrategy.PERFORM;
public StructuralTypePriorityExpansionStrategy() {
}
public StructuralTypePriorityExpansionStrategy(InitialEntailmentCheckStrategy initialEntailmentCheckStrategy) {
this.initialEntailmentCheckStrategy = initialEntailmentCheckStrategy;
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/StructuralTypePriorityExpansionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 16-Sep-2008<br><br>
*/
public class StructuralTypePriorityExpansionStrategy implements ExpansionStrategy {
private int count = 0;
private InitialEntailmentCheckStrategy initialEntailmentCheckStrategy = InitialEntailmentCheckStrategy.PERFORM;
public StructuralTypePriorityExpansionStrategy() {
}
public StructuralTypePriorityExpansionStrategy(InitialEntailmentCheckStrategy initialEntailmentCheckStrategy) {
this.initialEntailmentCheckStrategy = initialEntailmentCheckStrategy;
}
| public Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/StructuralTypePriorityExpansionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 16-Sep-2008<br><br>
*/
public class StructuralTypePriorityExpansionStrategy implements ExpansionStrategy {
private int count = 0;
private InitialEntailmentCheckStrategy initialEntailmentCheckStrategy = InitialEntailmentCheckStrategy.PERFORM;
public StructuralTypePriorityExpansionStrategy() {
}
public StructuralTypePriorityExpansionStrategy(InitialEntailmentCheckStrategy initialEntailmentCheckStrategy) {
this.initialEntailmentCheckStrategy = initialEntailmentCheckStrategy;
}
public Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) {
Set<OWLAxiom> expansion;
try {
count = 0;
if(progressMonitor.isCancelled()) { | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/StructuralTypePriorityExpansionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 16-Sep-2008<br><br>
*/
public class StructuralTypePriorityExpansionStrategy implements ExpansionStrategy {
private int count = 0;
private InitialEntailmentCheckStrategy initialEntailmentCheckStrategy = InitialEntailmentCheckStrategy.PERFORM;
public StructuralTypePriorityExpansionStrategy() {
}
public StructuralTypePriorityExpansionStrategy(InitialEntailmentCheckStrategy initialEntailmentCheckStrategy) {
this.initialEntailmentCheckStrategy = initialEntailmentCheckStrategy;
}
public Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) {
Set<OWLAxiom> expansion;
try {
count = 0;
if(progressMonitor.isCancelled()) { | throw new ExplanationGeneratorInterruptedException(); |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlusWithDeltaPlusFiltering.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
| import org.semanticweb.owl.explanation.api.*;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import java.util.*; | package org.semanticweb.owl.explanation.impl.laconic;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 26/04/2011
*/
public class LaconicExplanationGeneratorBasedOnOPlusWithDeltaPlusFiltering implements ExplanationGenerator<OWLAxiom> {
private Set<OWLAxiom> inputAxioms;
| // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlusWithDeltaPlusFiltering.java
import org.semanticweb.owl.explanation.api.*;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import java.util.*;
package org.semanticweb.owl.explanation.impl.laconic;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 26/04/2011
*/
public class LaconicExplanationGeneratorBasedOnOPlusWithDeltaPlusFiltering implements ExplanationGenerator<OWLAxiom> {
private Set<OWLAxiom> inputAxioms;
| private EntailmentCheckerFactory<OWLAxiom> entailmentCheckerFactory; |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ModularityContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.explanation.ordering.Tree;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import java.util.*; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 25-Sep-2008<br><br>
*/
public class ModularityContractionStrategy implements ContractionStrategy {
private int count = 0;
private int windowSize;
private int counter = 0;
private static void toList(Tree<OWLAxiom> tree, List<OWLAxiom> axioms, EntailmentChecker checker) {
OWLAxiom axiom = tree.getUserObject();
if (!axiom.equals(checker.getEntailment())) {
axioms.add(axiom);
}
for (Tree<OWLAxiom> t : tree.getChildren()) {
toList(t, axioms, checker);
}
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ModularityContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.explanation.ordering.Tree;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import java.util.*;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 25-Sep-2008<br><br>
*/
public class ModularityContractionStrategy implements ContractionStrategy {
private int count = 0;
private int windowSize;
private int counter = 0;
private static void toList(Tree<OWLAxiom> tree, List<OWLAxiom> axioms, EntailmentChecker checker) {
OWLAxiom axiom = tree.getUserObject();
if (!axiom.equals(checker.getEntailment())) {
axioms.add(axiom);
}
for (Tree<OWLAxiom> t : tree.getChildren()) {
toList(t, axioms, checker);
}
}
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
| import org.semanticweb.owl.explanation.api.*;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import java.util.*; | package org.semanticweb.owl.explanation.impl.laconic;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 23/04/2011
*/
public class LaconicExplanationGeneratorBasedOnOPlus implements ExplanationGenerator<OWLAxiom> {
private Set<OWLAxiom> inputAxioms;
| // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java
import org.semanticweb.owl.explanation.api.*;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import java.util.*;
package org.semanticweb.owl.explanation.impl.laconic;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 23/04/2011
*/
public class LaconicExplanationGeneratorBasedOnOPlus implements ExplanationGenerator<OWLAxiom> {
private Set<OWLAxiom> inputAxioms;
| private EntailmentCheckerFactory<OWLAxiom> entailmentCheckerFactory; |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/OrderedAxiomWithWindowContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;/* | package org.semanticweb.owl.explanation.impl.blackbox;
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University of Manchester<br> Information Management Group<br>
* Date: 27-Nov-2008
*/
public class OrderedAxiomWithWindowContractionStrategy implements ContractionStrategy {
private Object lastEntailment;
private int cumulativeExpansionSize;
private int cumulativeJustificationSize;
private double justificationToExpansionRatio;
private Set<OWLAxiom> lastJustification;
private int count = 0;
public OrderedAxiomWithWindowContractionStrategy() {
lastJustification = new HashSet<OWLAxiom>();
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/OrderedAxiomWithWindowContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;/*
package org.semanticweb.owl.explanation.impl.blackbox;
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University of Manchester<br> Information Management Group<br>
* Date: 27-Nov-2008
*/
public class OrderedAxiomWithWindowContractionStrategy implements ContractionStrategy {
private Object lastEntailment;
private int cumulativeExpansionSize;
private int cumulativeJustificationSize;
private double justificationToExpansionRatio;
private Set<OWLAxiom> lastJustification;
private int count = 0;
public OrderedAxiomWithWindowContractionStrategy() {
lastJustification = new HashSet<OWLAxiom>();
}
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/ConsistencyEntailmentCheckerFactory.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
| import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.OWLAxiom; | package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 01-May-2009
*/
public class ConsistencyEntailmentCheckerFactory implements EntailmentCheckerFactory<OWLAxiom> {
private OWLReasonerFactory reasonerFactory;
private long timeout = Long.MAX_VALUE;
// public ConsistencyEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory) {
// this(reasonerFactory, Long.MAX_VALUE);
// }
public ConsistencyEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, long timeout) {
this.reasonerFactory = reasonerFactory;
this.timeout = timeout;
}
| // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/ConsistencyEntailmentCheckerFactory.java
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 01-May-2009
*/
public class ConsistencyEntailmentCheckerFactory implements EntailmentCheckerFactory<OWLAxiom> {
private OWLReasonerFactory reasonerFactory;
private long timeout = Long.MAX_VALUE;
// public ConsistencyEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory) {
// this(reasonerFactory, Long.MAX_VALUE);
// }
public ConsistencyEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, long timeout) {
this.reasonerFactory = reasonerFactory;
this.timeout = timeout;
}
| public EntailmentChecker<OWLAxiom> createEntailementChecker(OWLAxiom entailment) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorFactory.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGenerator.java
// public interface ExplanationGenerator<E> {
//
// /**
// * Gets explanations for an entailment. All explanations for the entailment will be returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @return A set containing all of the explanations. The set will be empty if the entailment does not hold.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment) throws ExplanationException;
//
//
// /**
// * Gets explanations for an entailment, with limit on the number of explanations returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @param limit The maximum number of explanations to generate. This should be a positive integer.
// * @return A set containing explanations. The maximum cardinality of the set is specified by the limit parameter.
// * The set may be empty if the entailment does not hold, or if a limit of zero or less is supplied.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment, int limit) throws ExplanationException;
//
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorFactory.java
// public interface ExplanationGeneratorFactory<E> {
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology);
//
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology, ExplanationProgressMonitor<E> progressMonitor);
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms);
//
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms, ExplanationProgressMonitor<E> progressMonitor);
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationGenerator;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorFactory;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import java.util.HashSet;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.laconic;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 15-Sep-2008<br><br>
*/
public class LaconicExplanationGeneratorFactory<E> implements ExplanationGeneratorFactory<E> {
private ExplanationGeneratorFactory<E> explanationGeneratorFactory;
public LaconicExplanationGeneratorFactory( ExplanationGeneratorFactory<E> explanationGeneratorFactory) {
this.explanationGeneratorFactory = explanationGeneratorFactory;
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGenerator.java
// public interface ExplanationGenerator<E> {
//
// /**
// * Gets explanations for an entailment. All explanations for the entailment will be returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @return A set containing all of the explanations. The set will be empty if the entailment does not hold.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment) throws ExplanationException;
//
//
// /**
// * Gets explanations for an entailment, with limit on the number of explanations returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @param limit The maximum number of explanations to generate. This should be a positive integer.
// * @return A set containing explanations. The maximum cardinality of the set is specified by the limit parameter.
// * The set may be empty if the entailment does not hold, or if a limit of zero or less is supplied.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment, int limit) throws ExplanationException;
//
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorFactory.java
// public interface ExplanationGeneratorFactory<E> {
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology);
//
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology, ExplanationProgressMonitor<E> progressMonitor);
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms);
//
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms, ExplanationProgressMonitor<E> progressMonitor);
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorFactory.java
import org.semanticweb.owl.explanation.api.ExplanationGenerator;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorFactory;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import java.util.HashSet;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.laconic;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 15-Sep-2008<br><br>
*/
public class LaconicExplanationGeneratorFactory<E> implements ExplanationGeneratorFactory<E> {
private ExplanationGeneratorFactory<E> explanationGeneratorFactory;
public LaconicExplanationGeneratorFactory( ExplanationGeneratorFactory<E> explanationGeneratorFactory) {
this.explanationGeneratorFactory = explanationGeneratorFactory;
}
| public ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorFactory.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGenerator.java
// public interface ExplanationGenerator<E> {
//
// /**
// * Gets explanations for an entailment. All explanations for the entailment will be returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @return A set containing all of the explanations. The set will be empty if the entailment does not hold.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment) throws ExplanationException;
//
//
// /**
// * Gets explanations for an entailment, with limit on the number of explanations returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @param limit The maximum number of explanations to generate. This should be a positive integer.
// * @return A set containing explanations. The maximum cardinality of the set is specified by the limit parameter.
// * The set may be empty if the entailment does not hold, or if a limit of zero or less is supplied.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment, int limit) throws ExplanationException;
//
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorFactory.java
// public interface ExplanationGeneratorFactory<E> {
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology);
//
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology, ExplanationProgressMonitor<E> progressMonitor);
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms);
//
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms, ExplanationProgressMonitor<E> progressMonitor);
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationGenerator;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorFactory;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import java.util.HashSet;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.laconic;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 15-Sep-2008<br><br>
*/
public class LaconicExplanationGeneratorFactory<E> implements ExplanationGeneratorFactory<E> {
private ExplanationGeneratorFactory<E> explanationGeneratorFactory;
public LaconicExplanationGeneratorFactory( ExplanationGeneratorFactory<E> explanationGeneratorFactory) {
this.explanationGeneratorFactory = explanationGeneratorFactory;
}
public ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology) {
return createExplanationGenerator(ontology, null);
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGenerator.java
// public interface ExplanationGenerator<E> {
//
// /**
// * Gets explanations for an entailment. All explanations for the entailment will be returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @return A set containing all of the explanations. The set will be empty if the entailment does not hold.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment) throws ExplanationException;
//
//
// /**
// * Gets explanations for an entailment, with limit on the number of explanations returned.
// *
// * @param entailment The entailment for which explanations will be generated.
// * @param limit The maximum number of explanations to generate. This should be a positive integer.
// * @return A set containing explanations. The maximum cardinality of the set is specified by the limit parameter.
// * The set may be empty if the entailment does not hold, or if a limit of zero or less is supplied.
// * @throws ExplanationException if there was a problem generating the explanation.
// */
// Set<Explanation<E>> getExplanations(E entailment, int limit) throws ExplanationException;
//
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorFactory.java
// public interface ExplanationGeneratorFactory<E> {
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology);
//
//
// /**
// * Creates an explanation generator that draws source axioms for the explanation from an ontology and its imports
// * closure.
// *
// * @param ontology The ontology from which the source axioms are obtained.
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the axioms in the imports closure
// * of the specified ontology
// */
// ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology, ExplanationProgressMonitor<E> progressMonitor);
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms);
//
//
// /**
// * Creates an explanation generator that generates explanations for entailments that hold over the specified set
// * of axioms
// * @param axioms The axioms that give rise to the entailments
// * @param progressMonitor A progress monitor that gets informed of when explanations are found (should not be
// * <code>null</code>)
// * @return An explanation generator that generates explanations based on the specified set of axioms
// */
// ExplanationGenerator<E> createExplanationGenerator(Set<? extends OWLAxiom> axioms, ExplanationProgressMonitor<E> progressMonitor);
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorFactory.java
import org.semanticweb.owl.explanation.api.ExplanationGenerator;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorFactory;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import java.util.HashSet;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.laconic;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 15-Sep-2008<br><br>
*/
public class LaconicExplanationGeneratorFactory<E> implements ExplanationGeneratorFactory<E> {
private ExplanationGeneratorFactory<E> explanationGeneratorFactory;
public LaconicExplanationGeneratorFactory( ExplanationGeneratorFactory<E> explanationGeneratorFactory) {
this.explanationGeneratorFactory = explanationGeneratorFactory;
}
public ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology) {
return createExplanationGenerator(ontology, null);
}
| public ExplanationGenerator<E> createExplanationGenerator(OWLOntology ontology, ExplanationProgressMonitor<E> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/OrderedDivideAndConquerStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.util.AxiomSubjectProvider;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 13/01/2011
*/
public class OrderedDivideAndConquerStrategy implements ContractionStrategy {
private DivideAndConquerContractionStrategy delegate = new DivideAndConquerContractionStrategy();
private int count = 0;
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/OrderedDivideAndConquerStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.util.AxiomSubjectProvider;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 13/01/2011
*/
public class OrderedDivideAndConquerStrategy implements ContractionStrategy {
private DivideAndConquerContractionStrategy delegate = new DivideAndConquerContractionStrategy();
private int count = 0;
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/DynamicSlidingWindowContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.*;
import java.util.*; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 06-May-2009
*/
public class DynamicSlidingWindowContractionStrategy implements ContractionStrategy {
final private int windowSize;
private int count;
public DynamicSlidingWindowContractionStrategy() {
windowSize = 20;
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/DynamicSlidingWindowContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.*;
import java.util.*;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 06-May-2009
*/
public class DynamicSlidingWindowContractionStrategy implements ContractionStrategy {
final private int windowSize;
private int count;
public DynamicSlidingWindowContractionStrategy() {
windowSize = 20;
}
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/PatternBasedConsistencyEntailmentCheckerFactory.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
| import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; | package org.semanticweb.owl.explanation.impl.blackbox.checker;
/**
* Author: Matthew Horridge<br>
* Stanford University<br>
* Bio-Medical Informatics Research Group<br>
* Date: 14/08/2012
*/
public class PatternBasedConsistencyEntailmentCheckerFactory implements EntailmentCheckerFactory<OWLAxiom> {
private OWLReasonerFactory rf;
private long timeout;
public PatternBasedConsistencyEntailmentCheckerFactory(OWLReasonerFactory rf, long timeout) {
this.rf = rf;
this.timeout = timeout;
}
| // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/PatternBasedConsistencyEntailmentCheckerFactory.java
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
package org.semanticweb.owl.explanation.impl.blackbox.checker;
/**
* Author: Matthew Horridge<br>
* Stanford University<br>
* Bio-Medical Informatics Research Group<br>
* Date: 14/08/2012
*/
public class PatternBasedConsistencyEntailmentCheckerFactory implements EntailmentCheckerFactory<OWLAxiom> {
private OWLReasonerFactory rf;
private long timeout;
public PatternBasedConsistencyEntailmentCheckerFactory(OWLReasonerFactory rf, long timeout) {
this.rf = rf;
this.timeout = timeout;
}
| public EntailmentChecker<OWLAxiom> createEntailementChecker(OWLAxiom entailment) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/DivideAndConquerContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.*; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 24-May-2009
*
* This contraction strategy is based on Algorithm 2 presented in Baader and Suntisrivaraporn
* in "Debugging Snomed CT Using Axiom Pinpointing in the Description Logic EL+".
*/
public class DivideAndConquerContractionStrategy implements ContractionStrategy {
private int count;
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/DivideAndConquerContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.*;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 24-May-2009
*
* This contraction strategy is based on Algorithm 2 presented in Baader and Suntisrivaraporn
* in "Debugging Snomed CT Using Axiom Pinpointing in the Description Logic EL+".
*/
public class DivideAndConquerContractionStrategy implements ContractionStrategy {
private int count;
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/DivideAndConquerContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.*; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 24-May-2009
*
* This contraction strategy is based on Algorithm 2 presented in Baader and Suntisrivaraporn
* in "Debugging Snomed CT Using Axiom Pinpointing in the Description Logic EL+".
*/
public class DivideAndConquerContractionStrategy implements ContractionStrategy {
private int count;
public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) {
count = 0;
List<OWLAxiom> axiomList = new ArrayList<OWLAxiom>(axioms);
List<OWLAxiom> result = extract(new ArrayList<OWLAxiom>(), axiomList, checker, progressMonitor);
return new HashSet<OWLAxiom>(result);
}
public List<OWLAxiom> extract(List<OWLAxiom> listS, List<OWLAxiom> listO, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) {
if(progressMonitor.isCancelled()) { | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/DivideAndConquerContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.*;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 24-May-2009
*
* This contraction strategy is based on Algorithm 2 presented in Baader and Suntisrivaraporn
* in "Debugging Snomed CT Using Axiom Pinpointing in the Description Logic EL+".
*/
public class DivideAndConquerContractionStrategy implements ContractionStrategy {
private int count;
public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) {
count = 0;
List<OWLAxiom> axiomList = new ArrayList<OWLAxiom>(axioms);
List<OWLAxiom> result = extract(new ArrayList<OWLAxiom>(), axiomList, checker, progressMonitor);
return new HashSet<OWLAxiom>(result);
}
public List<OWLAxiom> extract(List<OWLAxiom> listS, List<OWLAxiom> listO, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) {
if(progressMonitor.isCancelled()) { | throw new ExplanationGeneratorInterruptedException(); |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/StructuralExpansionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*/
public class StructuralExpansionStrategy implements ExpansionStrategy {
private int count = 0;
public StructuralExpansionStrategy() {
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/StructuralExpansionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*/
public class StructuralExpansionStrategy implements ExpansionStrategy {
private int count = 0;
public StructuralExpansionStrategy() {
}
| public Set<OWLAxiom> doExpansion(final Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/SimpleContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.HashSet;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*/
public class SimpleContractionStrategy implements ContractionStrategy {
private int count = 0;
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/SimpleContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.HashSet;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*/
public class SimpleContractionStrategy implements ContractionStrategy {
private int count = 0;
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/InconsistentOntologyContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 01-May-2009
*/
public class InconsistentOntologyContractionStrategy extends DivideAndConquerContractionStrategy {
public InconsistentOntologyContractionStrategy() {
super();
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/InconsistentOntologyContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 01-May-2009
*/
public class InconsistentOntologyContractionStrategy extends DivideAndConquerContractionStrategy {
public InconsistentOntologyContractionStrategy() {
super();
}
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/DefaultBlackBoxConfiguration.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/Configuration.java
// public class Configuration<E> {
//
// private EntailmentCheckerFactory<E> checkerFactory;
//
// private ExpansionStrategy expansionStrategy;
//
// private ContractionStrategy contractionStrategy;
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy) {
// this(checkerFactory, expansionStrategy, contractionStrategy, null);
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy, ExplanationProgressMonitor<E> progressMonitor) {
// this.checkerFactory = checkerFactory;
// this.contractionStrategy = contractionStrategy;
// this.expansionStrategy = expansionStrategy;
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy());
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExplanationProgressMonitor<E> progressMonitor) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy(), progressMonitor);
// }
//
//
// public EntailmentCheckerFactory<E> getCheckerFactory() {
// return checkerFactory;
// }
//
//
// public ContractionStrategy getContractionStrategy() {
// return contractionStrategy;
// }
//
//
// public ExpansionStrategy getExpansionStrategy() {
// return expansionStrategy;
// }
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ContractionStrategy.java
// public interface ContractionStrategy {
//
// Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ExpansionStrategy.java
// public interface ExpansionStrategy {
//
// /**
// * Given an input set of axioms, returns a subset of axioms in which the entailment holds, or the empty set
// * if the entailment does not hold in the input set.
// * @param axioms The input set. The entailment may or may not hold in this set.
// * @param checker The entailment checker that should be used to check for entailment at
// * each stage.
// * @param progressMonitor A progress monitor. Not {@code null}.
// * @return A set of axioms that the entailment holds in, or the empty set if the entailment does not hold in the
// * input set.
// */
// Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
| import org.semanticweb.owl.explanation.impl.blackbox.Configuration;
import org.semanticweb.owl.explanation.impl.blackbox.ContractionStrategy;
import org.semanticweb.owl.explanation.impl.blackbox.ExpansionStrategy;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.OWLAxiom; | package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A default black box configuration that uses an entailment checker that reduced entailment checking to
* satisfiability checking using an OWLReasoner.
*/
public class DefaultBlackBoxConfiguration extends Configuration<OWLAxiom> {
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory) {
super(new SatisfiabilityEntailmentCheckerFactory(reasonerFactory));
}
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory, | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/Configuration.java
// public class Configuration<E> {
//
// private EntailmentCheckerFactory<E> checkerFactory;
//
// private ExpansionStrategy expansionStrategy;
//
// private ContractionStrategy contractionStrategy;
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy) {
// this(checkerFactory, expansionStrategy, contractionStrategy, null);
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy, ExplanationProgressMonitor<E> progressMonitor) {
// this.checkerFactory = checkerFactory;
// this.contractionStrategy = contractionStrategy;
// this.expansionStrategy = expansionStrategy;
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy());
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExplanationProgressMonitor<E> progressMonitor) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy(), progressMonitor);
// }
//
//
// public EntailmentCheckerFactory<E> getCheckerFactory() {
// return checkerFactory;
// }
//
//
// public ContractionStrategy getContractionStrategy() {
// return contractionStrategy;
// }
//
//
// public ExpansionStrategy getExpansionStrategy() {
// return expansionStrategy;
// }
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ContractionStrategy.java
// public interface ContractionStrategy {
//
// Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ExpansionStrategy.java
// public interface ExpansionStrategy {
//
// /**
// * Given an input set of axioms, returns a subset of axioms in which the entailment holds, or the empty set
// * if the entailment does not hold in the input set.
// * @param axioms The input set. The entailment may or may not hold in this set.
// * @param checker The entailment checker that should be used to check for entailment at
// * each stage.
// * @param progressMonitor A progress monitor. Not {@code null}.
// * @return A set of axioms that the entailment holds in, or the empty set if the entailment does not hold in the
// * input set.
// */
// Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/DefaultBlackBoxConfiguration.java
import org.semanticweb.owl.explanation.impl.blackbox.Configuration;
import org.semanticweb.owl.explanation.impl.blackbox.ContractionStrategy;
import org.semanticweb.owl.explanation.impl.blackbox.ExpansionStrategy;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A default black box configuration that uses an entailment checker that reduced entailment checking to
* satisfiability checking using an OWLReasoner.
*/
public class DefaultBlackBoxConfiguration extends Configuration<OWLAxiom> {
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory) {
super(new SatisfiabilityEntailmentCheckerFactory(reasonerFactory));
}
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory, | ExpansionStrategy expansionStrategy, |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/DefaultBlackBoxConfiguration.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/Configuration.java
// public class Configuration<E> {
//
// private EntailmentCheckerFactory<E> checkerFactory;
//
// private ExpansionStrategy expansionStrategy;
//
// private ContractionStrategy contractionStrategy;
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy) {
// this(checkerFactory, expansionStrategy, contractionStrategy, null);
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy, ExplanationProgressMonitor<E> progressMonitor) {
// this.checkerFactory = checkerFactory;
// this.contractionStrategy = contractionStrategy;
// this.expansionStrategy = expansionStrategy;
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy());
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExplanationProgressMonitor<E> progressMonitor) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy(), progressMonitor);
// }
//
//
// public EntailmentCheckerFactory<E> getCheckerFactory() {
// return checkerFactory;
// }
//
//
// public ContractionStrategy getContractionStrategy() {
// return contractionStrategy;
// }
//
//
// public ExpansionStrategy getExpansionStrategy() {
// return expansionStrategy;
// }
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ContractionStrategy.java
// public interface ContractionStrategy {
//
// Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ExpansionStrategy.java
// public interface ExpansionStrategy {
//
// /**
// * Given an input set of axioms, returns a subset of axioms in which the entailment holds, or the empty set
// * if the entailment does not hold in the input set.
// * @param axioms The input set. The entailment may or may not hold in this set.
// * @param checker The entailment checker that should be used to check for entailment at
// * each stage.
// * @param progressMonitor A progress monitor. Not {@code null}.
// * @return A set of axioms that the entailment holds in, or the empty set if the entailment does not hold in the
// * input set.
// */
// Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
| import org.semanticweb.owl.explanation.impl.blackbox.Configuration;
import org.semanticweb.owl.explanation.impl.blackbox.ContractionStrategy;
import org.semanticweb.owl.explanation.impl.blackbox.ExpansionStrategy;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.OWLAxiom; | package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A default black box configuration that uses an entailment checker that reduced entailment checking to
* satisfiability checking using an OWLReasoner.
*/
public class DefaultBlackBoxConfiguration extends Configuration<OWLAxiom> {
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory) {
super(new SatisfiabilityEntailmentCheckerFactory(reasonerFactory));
}
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory,
ExpansionStrategy expansionStrategy, | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/Configuration.java
// public class Configuration<E> {
//
// private EntailmentCheckerFactory<E> checkerFactory;
//
// private ExpansionStrategy expansionStrategy;
//
// private ContractionStrategy contractionStrategy;
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy) {
// this(checkerFactory, expansionStrategy, contractionStrategy, null);
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy, ExplanationProgressMonitor<E> progressMonitor) {
// this.checkerFactory = checkerFactory;
// this.contractionStrategy = contractionStrategy;
// this.expansionStrategy = expansionStrategy;
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy());
// }
//
//
// public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExplanationProgressMonitor<E> progressMonitor) {
// this(checkerFactory, new StructuralTypePriorityExpansionStrategy(), new DivideAndConquerContractionStrategy(), progressMonitor);
// }
//
//
// public EntailmentCheckerFactory<E> getCheckerFactory() {
// return checkerFactory;
// }
//
//
// public ContractionStrategy getContractionStrategy() {
// return contractionStrategy;
// }
//
//
// public ExpansionStrategy getExpansionStrategy() {
// return expansionStrategy;
// }
//
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ContractionStrategy.java
// public interface ContractionStrategy {
//
// Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/ExpansionStrategy.java
// public interface ExpansionStrategy {
//
// /**
// * Given an input set of axioms, returns a subset of axioms in which the entailment holds, or the empty set
// * if the entailment does not hold in the input set.
// * @param axioms The input set. The entailment may or may not hold in this set.
// * @param checker The entailment checker that should be used to check for entailment at
// * each stage.
// * @param progressMonitor A progress monitor. Not {@code null}.
// * @return A set of axioms that the entailment holds in, or the empty set if the entailment does not hold in the
// * input set.
// */
// Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor);
//
// int getNumberOfSteps();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/DefaultBlackBoxConfiguration.java
import org.semanticweb.owl.explanation.impl.blackbox.Configuration;
import org.semanticweb.owl.explanation.impl.blackbox.ContractionStrategy;
import org.semanticweb.owl.explanation.impl.blackbox.ExpansionStrategy;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A default black box configuration that uses an entailment checker that reduced entailment checking to
* satisfiability checking using an OWLReasoner.
*/
public class DefaultBlackBoxConfiguration extends Configuration<OWLAxiom> {
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory) {
super(new SatisfiabilityEntailmentCheckerFactory(reasonerFactory));
}
public DefaultBlackBoxConfiguration(OWLReasonerFactory reasonerFactory,
ExpansionStrategy expansionStrategy, | ContractionStrategy contractionStrategy) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/rootderived/StructuralRootDerivedReasoner.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationException.java
// public class ExplanationException extends OWLRuntimeException {
//
//
// public ExplanationException(Throwable cause) {
// super(cause);
// }
//
//
// public ExplanationException(String message) {
// super(message);
// }
//
//
// public ExplanationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/RootDerivedReasoner.java
// public interface RootDerivedReasoner {
//
// /**
// * Gets the root unsatisfiable classes.
// * @return A set of classes that represent the root unsatisfiable classes
// */
// Set<OWLClass> getRootUnsatisfiableClasses() throws ExplanationException;
//
// Set<OWLClass> getDependentChildClasses(OWLClass cls);
//
//
// Set<OWLClass> getDependentDescendantClasses(OWLClass cls);
// }
| import org.semanticweb.owl.explanation.api.ExplanationException;
import org.semanticweb.owl.explanation.api.RootDerivedReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.search.EntitySearcher;
import java.util.*; | package org.semanticweb.owl.explanation.impl.rootderived;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 07-Sep-2008<br><br>
*/
public class StructuralRootDerivedReasoner implements RootDerivedReasoner {
private OWLOntologyManager man;
private OWLReasoner reasoner;
private OWLReasonerFactory reasonerFactory;
private OWLOntology mergedOntology;
private Map<OWLClass, Set<OWLClass>> child2Parent;
private Map<OWLClass, Set<OWLClass>> parent2Child;
private Set<OWLClass> roots;
private boolean dirty;
public StructuralRootDerivedReasoner(OWLOntologyManager man, OWLReasoner reasoner, OWLReasonerFactory reasonerFactory) {
this.man = man;
this.reasonerFactory = reasonerFactory;
this.reasoner = reasoner;
this.child2Parent = new HashMap<OWLClass, Set<OWLClass>>();
this.parent2Child = new HashMap<OWLClass, Set<OWLClass>>();
roots = new HashSet<OWLClass>();
try {
getMergedOntology();
} | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationException.java
// public class ExplanationException extends OWLRuntimeException {
//
//
// public ExplanationException(Throwable cause) {
// super(cause);
// }
//
//
// public ExplanationException(String message) {
// super(message);
// }
//
//
// public ExplanationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/RootDerivedReasoner.java
// public interface RootDerivedReasoner {
//
// /**
// * Gets the root unsatisfiable classes.
// * @return A set of classes that represent the root unsatisfiable classes
// */
// Set<OWLClass> getRootUnsatisfiableClasses() throws ExplanationException;
//
// Set<OWLClass> getDependentChildClasses(OWLClass cls);
//
//
// Set<OWLClass> getDependentDescendantClasses(OWLClass cls);
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/rootderived/StructuralRootDerivedReasoner.java
import org.semanticweb.owl.explanation.api.ExplanationException;
import org.semanticweb.owl.explanation.api.RootDerivedReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.search.EntitySearcher;
import java.util.*;
package org.semanticweb.owl.explanation.impl.rootderived;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 07-Sep-2008<br><br>
*/
public class StructuralRootDerivedReasoner implements RootDerivedReasoner {
private OWLOntologyManager man;
private OWLReasoner reasoner;
private OWLReasonerFactory reasonerFactory;
private OWLOntology mergedOntology;
private Map<OWLClass, Set<OWLClass>> child2Parent;
private Map<OWLClass, Set<OWLClass>> parent2Child;
private Set<OWLClass> roots;
private boolean dirty;
public StructuralRootDerivedReasoner(OWLOntologyManager man, OWLReasoner reasoner, OWLReasonerFactory reasonerFactory) {
this.man = man;
this.reasonerFactory = reasonerFactory;
this.reasoner = reasoner;
this.child2Parent = new HashMap<OWLClass, Set<OWLClass>>();
this.parent2Child = new HashMap<OWLClass, Set<OWLClass>>();
roots = new HashSet<OWLClass>();
try {
getMergedOntology();
} | catch (ExplanationException e) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/SlidingWindowContractionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A contraction strategy that uses a sliding window to improve performance.
*/
public class SlidingWindowContractionStrategy implements ContractionStrategy {
final private int windowSize;
private int count;
public SlidingWindowContractionStrategy() {
windowSize = 20;
}
public SlidingWindowContractionStrategy(int windowSize) {
this.windowSize = windowSize;
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/SlidingWindowContractionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A contraction strategy that uses a sliding window to improve performance.
*/
public class SlidingWindowContractionStrategy implements ContractionStrategy {
final private int windowSize;
private int count;
public SlidingWindowContractionStrategy() {
windowSize = 20;
}
public SlidingWindowContractionStrategy(int windowSize) {
this.windowSize = windowSize;
}
| public Set<OWLAxiom> doPruning(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/InconsistentOntologyExpansionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.*;
import java.util.*; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 01-May-2009
*/
public class InconsistentOntologyExpansionStrategy implements ExpansionStrategy {
public InconsistentOntologyExpansionStrategy() {
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/InconsistentOntologyExpansionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.*;
import java.util.*;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 01-May-2009
*/
public class InconsistentOntologyExpansionStrategy implements ExpansionStrategy {
public InconsistentOntologyExpansionStrategy() {
}
| public Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/Configuration.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A configuration that describes how a black box explanation generator should be configured.
* There are three main options: 1) The type of entailment checker that should be used, 2) The
* expansion strategy that should be used, 3) The contraction strategy that should be used
*/
public class Configuration<E> {
private EntailmentCheckerFactory<E> checkerFactory;
private ExpansionStrategy expansionStrategy;
private ContractionStrategy contractionStrategy;
public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy) {
this(checkerFactory, expansionStrategy, contractionStrategy, null);
}
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/Configuration.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A configuration that describes how a black box explanation generator should be configured.
* There are three main options: 1) The type of entailment checker that should be used, 2) The
* expansion strategy that should be used, 3) The contraction strategy that should be used
*/
public class Configuration<E> {
private EntailmentCheckerFactory<E> checkerFactory;
private ExpansionStrategy expansionStrategy;
private ContractionStrategy contractionStrategy;
public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy) {
this(checkerFactory, expansionStrategy, contractionStrategy, null);
}
| public Configuration(EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy expansionStrategy, ContractionStrategy contractionStrategy, ExplanationProgressMonitor<E> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/InconsistentOntologyClashExpansionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/ConsistencyEntailmentChecker.java
// public class ConsistencyEntailmentChecker implements org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker<OWLAxiom> {
//
// private OWLAxiom entailment;
//
// private OWLReasonerFactory reasonerFactory;
//
// private int counter;
//
// private boolean consistent = false;
//
// private long timeout = Long.MAX_VALUE;
//
// public ConsistencyEntailmentChecker(OWLReasonerFactory reasonerFactory, long timeout) {
// this.timeout = timeout;
// this.reasonerFactory = reasonerFactory;
// OWLDataFactory df = new OWLDataFactoryImpl();
// this.entailment = df.getOWLSubClassOfAxiom(
// df.getOWLThing(),
// df.getOWLNothing()
// );
// }
//
//
//
// public int getCounter() {
// return counter;
// }
//
// public void resetCounter() {
// counter = 0;
// }
//
// public OWLAxiom getEntailment() {
// return entailment;
// }
//
//
// public Set<OWLAxiom> getModule(Set<OWLAxiom> axioms) {
// return axioms;
// }
//
// public Set<OWLEntity> getEntailmentSignature() {
// return Collections.emptySet();
// }
//
// public Set<OWLEntity> getSeedSignature() {
// return Collections.emptySet();
// }
//
// public boolean isEntailed(final Set<OWLAxiom> axiom) {
//
// TelemetryTimer timer = new TelemetryTimer();
// TelemetryTimer loadTimer = new TelemetryTimer();
// TelemetryTimer checkTimer = new TelemetryTimer();
// TelemetryInfo info = new DefaultTelemetryInfo("entailmentcheck", timer, loadTimer, checkTimer);
// TelemetryTransmitter transmitter = TelemetryTransmitter.getTransmitter();
// transmitter.beginTransmission(info);
// try {
// // System.out.print("Checking entailment....");
// transmitter.recordMeasurement(info, "input size", axiom.size());
// counter++;
// timer.start();
// OWLOntologyManager man = OWLManager.createOWLOntologyManager();
// OWLOntology ont = man.createOntology(axiom);
// SimpleConfiguration config = new SimpleConfiguration(timeout);
// timer.start();
// loadTimer.start();
// OWLReasoner r = reasonerFactory.createReasoner(ont, config);
// loadTimer.stop();
// transmitter.recordTiming(info, "load time", timer);
// checkTimer.start();
// consistent = r.isConsistent();
// checkTimer.stop();
// timer.stop();
// transmitter.recordTiming(info, "check time", checkTimer);
// transmitter.recordTiming(info, "time", timer);
// r.dispose();
//
// // System.out.println(" done!");
// return !consistent;
// }
// catch (OWLOntologyCreationException e) {
// throw new OWLRuntimeException(e);
// }
// finally {
// transmitter.endTransmission(info);
// }
// }
//
// public String getModularisationTypeDescription() {
// return "none";
// }
//
// public boolean isUseModularisation() {
// return false;
// }
//
// public Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms) {
// return null;
// }
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owl.explanation.impl.blackbox.checker.ConsistencyEntailmentChecker;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 24-May-2009
*/
public class InconsistentOntologyClashExpansionStrategy implements ExpansionStrategy {
private int count = 0;
private StructuralTypePriorityExpansionStrategy strategy = new StructuralTypePriorityExpansionStrategy();
private InconsistentOntologyExpansionStrategy defaultStrategy = new InconsistentOntologyExpansionStrategy();
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/ConsistencyEntailmentChecker.java
// public class ConsistencyEntailmentChecker implements org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker<OWLAxiom> {
//
// private OWLAxiom entailment;
//
// private OWLReasonerFactory reasonerFactory;
//
// private int counter;
//
// private boolean consistent = false;
//
// private long timeout = Long.MAX_VALUE;
//
// public ConsistencyEntailmentChecker(OWLReasonerFactory reasonerFactory, long timeout) {
// this.timeout = timeout;
// this.reasonerFactory = reasonerFactory;
// OWLDataFactory df = new OWLDataFactoryImpl();
// this.entailment = df.getOWLSubClassOfAxiom(
// df.getOWLThing(),
// df.getOWLNothing()
// );
// }
//
//
//
// public int getCounter() {
// return counter;
// }
//
// public void resetCounter() {
// counter = 0;
// }
//
// public OWLAxiom getEntailment() {
// return entailment;
// }
//
//
// public Set<OWLAxiom> getModule(Set<OWLAxiom> axioms) {
// return axioms;
// }
//
// public Set<OWLEntity> getEntailmentSignature() {
// return Collections.emptySet();
// }
//
// public Set<OWLEntity> getSeedSignature() {
// return Collections.emptySet();
// }
//
// public boolean isEntailed(final Set<OWLAxiom> axiom) {
//
// TelemetryTimer timer = new TelemetryTimer();
// TelemetryTimer loadTimer = new TelemetryTimer();
// TelemetryTimer checkTimer = new TelemetryTimer();
// TelemetryInfo info = new DefaultTelemetryInfo("entailmentcheck", timer, loadTimer, checkTimer);
// TelemetryTransmitter transmitter = TelemetryTransmitter.getTransmitter();
// transmitter.beginTransmission(info);
// try {
// // System.out.print("Checking entailment....");
// transmitter.recordMeasurement(info, "input size", axiom.size());
// counter++;
// timer.start();
// OWLOntologyManager man = OWLManager.createOWLOntologyManager();
// OWLOntology ont = man.createOntology(axiom);
// SimpleConfiguration config = new SimpleConfiguration(timeout);
// timer.start();
// loadTimer.start();
// OWLReasoner r = reasonerFactory.createReasoner(ont, config);
// loadTimer.stop();
// transmitter.recordTiming(info, "load time", timer);
// checkTimer.start();
// consistent = r.isConsistent();
// checkTimer.stop();
// timer.stop();
// transmitter.recordTiming(info, "check time", checkTimer);
// transmitter.recordTiming(info, "time", timer);
// r.dispose();
//
// // System.out.println(" done!");
// return !consistent;
// }
// catch (OWLOntologyCreationException e) {
// throw new OWLRuntimeException(e);
// }
// finally {
// transmitter.endTransmission(info);
// }
// }
//
// public String getModularisationTypeDescription() {
// return "none";
// }
//
// public boolean isUseModularisation() {
// return false;
// }
//
// public Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms) {
// return null;
// }
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/InconsistentOntologyClashExpansionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owl.explanation.impl.blackbox.checker.ConsistencyEntailmentChecker;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2009, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Information Management Group<br>
* Date: 24-May-2009
*/
public class InconsistentOntologyClashExpansionStrategy implements ExpansionStrategy {
private int count = 0;
private StructuralTypePriorityExpansionStrategy strategy = new StructuralTypePriorityExpansionStrategy();
private InconsistentOntologyExpansionStrategy defaultStrategy = new InconsistentOntologyExpansionStrategy();
| public Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/SatisfiabilityEntailmentChecker.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationException.java
// public class ExplanationException extends OWLRuntimeException {
//
//
// public ExplanationException(Throwable cause) {
// super(cause);
// }
//
//
// public ExplanationException(String message) {
// super(message);
// }
//
//
// public ExplanationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
| import org.semanticweb.owl.explanation.api.ExplanationException;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.*;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set; | if (!ont.containsEntityInSignature(ent)) {
man.addAxiom(ont, man.getOWLDataFactory().getOWLDeclarationAxiom(ent));
}
}
}
String clsName = "Entailment" + System.currentTimeMillis();
OWLClass namingCls = man.getOWLDataFactory().getOWLClass(IRI.create(clsName));
OWLAxiom namingAxiom = man.getOWLDataFactory().getOWLSubClassOfAxiom(namingCls, unsatDesc);
man.addAxiom(ont, namingAxiom);
for (OWLEntity freshEntity : freshEntities) {
man.addAxiom(ont, man.getOWLDataFactory().getOWLDeclarationAxiom(freshEntity));
}
// Do the actual entailment check
counter++;
entailmentCheckTimer.start();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont, new SimpleConfiguration(new NullReasonerProgressMonitor(), FreshEntityPolicy.ALLOW, timeOutMS, IndividualNodeSetPolicy.BY_SAME_AS));
entailed = !reasoner.isSatisfiable(unsatDesc);
entailmentCheckTimer.stop();
reasoner.dispose();
man.removeOntology(ont);
if (entailed) {
lastEntailingAxioms.remove(namingAxiom);
lastEntailingAxioms.addAll(ont.getLogicalAxioms());
}
return entailed;
}
catch (OWLOntologyCreationException e) { | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationException.java
// public class ExplanationException extends OWLRuntimeException {
//
//
// public ExplanationException(Throwable cause) {
// super(cause);
// }
//
//
// public ExplanationException(String message) {
// super(message);
// }
//
//
// public ExplanationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/SatisfiabilityEntailmentChecker.java
import org.semanticweb.owl.explanation.api.ExplanationException;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.*;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
if (!ont.containsEntityInSignature(ent)) {
man.addAxiom(ont, man.getOWLDataFactory().getOWLDeclarationAxiom(ent));
}
}
}
String clsName = "Entailment" + System.currentTimeMillis();
OWLClass namingCls = man.getOWLDataFactory().getOWLClass(IRI.create(clsName));
OWLAxiom namingAxiom = man.getOWLDataFactory().getOWLSubClassOfAxiom(namingCls, unsatDesc);
man.addAxiom(ont, namingAxiom);
for (OWLEntity freshEntity : freshEntities) {
man.addAxiom(ont, man.getOWLDataFactory().getOWLDeclarationAxiom(freshEntity));
}
// Do the actual entailment check
counter++;
entailmentCheckTimer.start();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont, new SimpleConfiguration(new NullReasonerProgressMonitor(), FreshEntityPolicy.ALLOW, timeOutMS, IndividualNodeSetPolicy.BY_SAME_AS));
entailed = !reasoner.isSatisfiable(unsatDesc);
entailmentCheckTimer.stop();
reasoner.dispose();
man.removeOntology(ont);
if (entailed) {
lastEntailingAxioms.remove(namingAxiom);
lastEntailingAxioms.addAll(ont.getLogicalAxioms());
}
return entailed;
}
catch (OWLOntologyCreationException e) { | throw new ExplanationException(e); |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/SatisfiabilityEntailmentChecker.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationException.java
// public class ExplanationException extends OWLRuntimeException {
//
//
// public ExplanationException(Throwable cause) {
// super(cause);
// }
//
//
// public ExplanationException(String message) {
// super(message);
// }
//
//
// public ExplanationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
| import org.semanticweb.owl.explanation.api.ExplanationException;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.*;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set; | OWLClass namingCls = man.getOWLDataFactory().getOWLClass(IRI.create(clsName));
OWLAxiom namingAxiom = man.getOWLDataFactory().getOWLSubClassOfAxiom(namingCls, unsatDesc);
man.addAxiom(ont, namingAxiom);
for (OWLEntity freshEntity : freshEntities) {
man.addAxiom(ont, man.getOWLDataFactory().getOWLDeclarationAxiom(freshEntity));
}
// Do the actual entailment check
counter++;
entailmentCheckTimer.start();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont, new SimpleConfiguration(new NullReasonerProgressMonitor(), FreshEntityPolicy.ALLOW, timeOutMS, IndividualNodeSetPolicy.BY_SAME_AS));
entailed = !reasoner.isSatisfiable(unsatDesc);
entailmentCheckTimer.stop();
reasoner.dispose();
man.removeOntology(ont);
if (entailed) {
lastEntailingAxioms.remove(namingAxiom);
lastEntailingAxioms.addAll(ont.getLogicalAxioms());
}
return entailed;
}
catch (OWLOntologyCreationException e) {
throw new ExplanationException(e);
}
catch (TimeOutException e) {
transmitter.recordMeasurement(info, "reasoner time out", true);
throw e;
} | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationException.java
// public class ExplanationException extends OWLRuntimeException {
//
//
// public ExplanationException(Throwable cause) {
// super(cause);
// }
//
//
// public ExplanationException(String message) {
// super(message);
// }
//
//
// public ExplanationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationGeneratorInterruptedException.java
// public class ExplanationGeneratorInterruptedException extends ExplanationException {
//
// public ExplanationGeneratorInterruptedException() {
// super("Explanation generator interrupted");
// }
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/SatisfiabilityEntailmentChecker.java
import org.semanticweb.owl.explanation.api.ExplanationException;
import org.semanticweb.owl.explanation.api.ExplanationGeneratorInterruptedException;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.*;
import uk.ac.manchester.cs.owlapi.modularity.SyntacticLocalityModuleExtractor;
import uk.ac.manchester.cs.owlapi.modularity.ModuleType;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
OWLClass namingCls = man.getOWLDataFactory().getOWLClass(IRI.create(clsName));
OWLAxiom namingAxiom = man.getOWLDataFactory().getOWLSubClassOfAxiom(namingCls, unsatDesc);
man.addAxiom(ont, namingAxiom);
for (OWLEntity freshEntity : freshEntities) {
man.addAxiom(ont, man.getOWLDataFactory().getOWLDeclarationAxiom(freshEntity));
}
// Do the actual entailment check
counter++;
entailmentCheckTimer.start();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont, new SimpleConfiguration(new NullReasonerProgressMonitor(), FreshEntityPolicy.ALLOW, timeOutMS, IndividualNodeSetPolicy.BY_SAME_AS));
entailed = !reasoner.isSatisfiable(unsatDesc);
entailmentCheckTimer.stop();
reasoner.dispose();
man.removeOntology(ont);
if (entailed) {
lastEntailingAxioms.remove(namingAxiom);
lastEntailingAxioms.addAll(ont.getLogicalAxioms());
}
return entailed;
}
catch (OWLOntologyCreationException e) {
throw new ExplanationException(e);
}
catch (TimeOutException e) {
transmitter.recordMeasurement(info, "reasoner time out", true);
throw e;
} | catch (ExplanationGeneratorInterruptedException e) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/SimpleExpansionStrategy.java | // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
| import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set; | package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A very simple (inefficient, so used mainly for testing purposes) expansion strategy. One checker is
* added at a time.
*/
public class SimpleExpansionStrategy<E> implements ExpansionStrategy {
private int count = 0;
| // Path: src/main/java/org/semanticweb/owl/explanation/api/ExplanationProgressMonitor.java
// public interface ExplanationProgressMonitor<E> {
//
// /**
// * Called by explanation generators that support progress monitors. This is
// * called when a new explanation is found for an entailment when searching for
// * multiple explanations.
// *
// * @param generator The explanation generator that found the explanation
// * @param explanation The explanation that was found
// * for the entailment or <code>false</code> if the explanation generator should stop finding explanations
// * at the next opportunity.
// * @param allFoundExplanations All of the explanations found so far for the specified entailment
// */
// void foundExplanation(ExplanationGenerator<E> generator, Explanation<E> explanation, Set<Explanation<E>> allFoundExplanations);
//
// /**
// * The explanation generator will periodically check to see if it should continue finding explanations by calling
// * this method.
// *
// * @return <code>true</code> if the explanation generator should cancel the explanation finding process or <code>false</code>
// * if the explanation generator should continue.
// */
// boolean isCancelled();
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/SimpleExpansionStrategy.java
import org.semanticweb.owl.explanation.api.ExplanationProgressMonitor;
import org.semanticweb.owlapi.model.OWLAxiom;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
package org.semanticweb.owl.explanation.impl.blackbox;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*
* A very simple (inefficient, so used mainly for testing purposes) expansion strategy. One checker is
* added at a time.
*/
public class SimpleExpansionStrategy<E> implements ExpansionStrategy {
private int count = 0;
| public Set<OWLAxiom> doExpansion(Set<OWLAxiom> axioms, EntailmentChecker checker, ExplanationProgressMonitor<?> progressMonitor) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/SatisfiabilityEntailmentCheckerFactory.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
| import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; | package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*/
public class SatisfiabilityEntailmentCheckerFactory implements EntailmentCheckerFactory<OWLAxiom> {
private OWLReasonerFactory reasonerFactory;
private boolean useModularisation;
private long entailmentCheckTimeOutMS = Long.MAX_VALUE;
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory) {
this(reasonerFactory, true);
}
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, long entailmentCheckTimeOutMS) {
this.reasonerFactory = reasonerFactory;
this.entailmentCheckTimeOutMS = entailmentCheckTimeOutMS;
this.useModularisation = true;
}
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, boolean useModularisation) {
this.reasonerFactory = reasonerFactory;
this.useModularisation = useModularisation;
}
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, boolean useModularisation, long entailmentCheckTimeOutMS) {
this.reasonerFactory = reasonerFactory;
this.useModularisation = useModularisation;
this.entailmentCheckTimeOutMS = entailmentCheckTimeOutMS;
}
| // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentChecker.java
// public interface EntailmentChecker<E> {
//
// int getCounter();
//
// void resetCounter();
//
// E getEntailment();
//
// Set<OWLEntity> getEntailmentSignature();
//
// Set<OWLEntity> getSeedSignature();
//
// boolean isEntailed(Set<OWLAxiom> axiom);
//
// Set<OWLAxiom> getEntailingAxioms(Set<OWLAxiom> axioms);
//
// Set<OWLAxiom> getModule(Set<OWLAxiom> axioms);
//
// String getModularisationTypeDescription();
//
// boolean isUseModularisation();
// }
//
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/checker/SatisfiabilityEntailmentCheckerFactory.java
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentChecker;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
package org.semanticweb.owl.explanation.impl.blackbox.checker;
/*
* Copyright (C) 2008, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Matthew Horridge<br> The University Of Manchester<br> Information Management Group<br> Date:
* 03-Sep-2008<br><br>
*/
public class SatisfiabilityEntailmentCheckerFactory implements EntailmentCheckerFactory<OWLAxiom> {
private OWLReasonerFactory reasonerFactory;
private boolean useModularisation;
private long entailmentCheckTimeOutMS = Long.MAX_VALUE;
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory) {
this(reasonerFactory, true);
}
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, long entailmentCheckTimeOutMS) {
this.reasonerFactory = reasonerFactory;
this.entailmentCheckTimeOutMS = entailmentCheckTimeOutMS;
this.useModularisation = true;
}
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, boolean useModularisation) {
this.reasonerFactory = reasonerFactory;
this.useModularisation = useModularisation;
}
public SatisfiabilityEntailmentCheckerFactory(OWLReasonerFactory reasonerFactory, boolean useModularisation, long entailmentCheckTimeOutMS) {
this.reasonerFactory = reasonerFactory;
this.useModularisation = useModularisation;
this.entailmentCheckTimeOutMS = entailmentCheckTimeOutMS;
}
| public EntailmentChecker<OWLAxiom> createEntailementChecker(OWLAxiom entailment) { |
matthewhorridge/owlexplanation | src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnIncrementalOPlusWithDeltaPlusFiltering.java | // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
| import org.semanticweb.owl.explanation.api.*;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxObjectRenderer;
import org.semanticweb.owlapi.io.OWLObjectRenderer;
import org.semanticweb.owlapi.io.ToStringRenderer;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.util.SimpleRenderer;
import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl;
import java.util.*; | package org.semanticweb.owl.explanation.impl.laconic;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 06/05/2011
*/
public class LaconicExplanationGeneratorBasedOnIncrementalOPlusWithDeltaPlusFiltering implements ExplanationGenerator<OWLAxiom> {
private Set<OWLAxiom> inputAxioms;
private ExplanationGeneratorFactory<OWLAxiom> delegate;
| // Path: src/main/java/org/semanticweb/owl/explanation/impl/blackbox/EntailmentCheckerFactory.java
// public interface EntailmentCheckerFactory<E> {
//
// EntailmentChecker<E> createEntailementChecker(E entailment);
// }
// Path: src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnIncrementalOPlusWithDeltaPlusFiltering.java
import org.semanticweb.owl.explanation.api.*;
import org.semanticweb.owl.explanation.impl.blackbox.EntailmentCheckerFactory;
import org.semanticweb.owl.explanation.telemetry.DefaultTelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryInfo;
import org.semanticweb.owl.explanation.telemetry.TelemetryTimer;
import org.semanticweb.owl.explanation.telemetry.TelemetryTransmitter;
import org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxObjectRenderer;
import org.semanticweb.owlapi.io.OWLObjectRenderer;
import org.semanticweb.owlapi.io.ToStringRenderer;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.util.SimpleRenderer;
import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl;
import java.util.*;
package org.semanticweb.owl.explanation.impl.laconic;
/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 06/05/2011
*/
public class LaconicExplanationGeneratorBasedOnIncrementalOPlusWithDeltaPlusFiltering implements ExplanationGenerator<OWLAxiom> {
private Set<OWLAxiom> inputAxioms;
private ExplanationGeneratorFactory<OWLAxiom> delegate;
| private EntailmentCheckerFactory<OWLAxiom> entailmentCheckerFactory; |
apigee/apigee-android-sdk | samples/push/app/src/main/java/com/apigee/push/PushMainActivity.java | // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";
| import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG; | package com.apigee.push;
public class PushMainActivity extends Activity {
private TextView messageTextView;
private Button sendButton;
private AlertDialogManager alert = new AlertDialogManager();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// this is a hack to force AsyncTask to be initialized on main thread. Without this things
// won't work correctly on older versions of Android (2.2, apilevel=8)
try {
Class.forName("android.os.AsyncTask");
} catch (Exception ignored) {}
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
initUI();
AppServices.loginAndRegisterForPush(this);
}
private void initUI() {
setContentView(R.layout.main);
messageTextView = (TextView)findViewById(R.id.lblMessage);
sendButton = (Button)findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AppServices.sendMyselfANotification(v.getContext());
}
});
| // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";
// Path: samples/push/app/src/main/java/com/apigee/push/PushMainActivity.java
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG;
package com.apigee.push;
public class PushMainActivity extends Activity {
private TextView messageTextView;
private Button sendButton;
private AlertDialogManager alert = new AlertDialogManager();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// this is a hack to force AsyncTask to be initialized on main thread. Without this things
// won't work correctly on older versions of Android (2.2, apilevel=8)
try {
Class.forName("android.os.AsyncTask");
} catch (Exception ignored) {}
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
initUI();
AppServices.loginAndRegisterForPush(this);
}
private void initUI() {
setContentView(R.layout.main);
messageTextView = (TextView)findViewById(R.id.lblMessage);
sendButton = (Button)findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AppServices.sendMyselfANotification(v.getContext());
}
});
| registerReceiver(notificationReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION)); |
apigee/apigee-android-sdk | samples/push/app/src/main/java/com/apigee/push/PushMainActivity.java | // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";
| import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG; | }
private void initUI() {
setContentView(R.layout.main);
messageTextView = (TextView)findViewById(R.id.lblMessage);
sendButton = (Button)findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AppServices.sendMyselfANotification(v.getContext());
}
});
registerReceiver(notificationReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION));
}
/**
* Receives push Notifications
* */
private final BroadcastReceiver notificationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Waking up mobile if it is sleeping
WakeLocker.acquire(getApplicationContext());
/**
* Take some action upon receiving a push notification here!
**/ | // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";
// Path: samples/push/app/src/main/java/com/apigee/push/PushMainActivity.java
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG;
}
private void initUI() {
setContentView(R.layout.main);
messageTextView = (TextView)findViewById(R.id.lblMessage);
sendButton = (Button)findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AppServices.sendMyselfANotification(v.getContext());
}
});
registerReceiver(notificationReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION));
}
/**
* Receives push Notifications
* */
private final BroadcastReceiver notificationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Waking up mobile if it is sleeping
WakeLocker.acquire(getApplicationContext());
/**
* Take some action upon receiving a push notification here!
**/ | String message = intent.getExtras().getString(EXTRA_MESSAGE); |
apigee/apigee-android-sdk | samples/push/app/src/main/java/com/apigee/push/PushMainActivity.java | // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";
| import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG; | setContentView(R.layout.main);
messageTextView = (TextView)findViewById(R.id.lblMessage);
sendButton = (Button)findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AppServices.sendMyselfANotification(v.getContext());
}
});
registerReceiver(notificationReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION));
}
/**
* Receives push Notifications
* */
private final BroadcastReceiver notificationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Waking up mobile if it is sleeping
WakeLocker.acquire(getApplicationContext());
/**
* Take some action upon receiving a push notification here!
**/
String message = intent.getExtras().getString(EXTRA_MESSAGE);
if (message == null) { message = "Empty Message"; }
| // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String DISPLAY_MESSAGE_ACTION = "com.ganyo.pushtest.DISPLAY_MESSAGE";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String EXTRA_MESSAGE = "message";
//
// Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static final String TAG = "com.ganyo.pushtest";
// Path: samples/push/app/src/main/java/com/apigee/push/PushMainActivity.java
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gcm.GCMRegistrar;
import static com.apigee.push.Util.DISPLAY_MESSAGE_ACTION;
import static com.apigee.push.Util.EXTRA_MESSAGE;
import static com.apigee.push.Util.TAG;
setContentView(R.layout.main);
messageTextView = (TextView)findViewById(R.id.lblMessage);
sendButton = (Button)findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
AppServices.sendMyselfANotification(v.getContext());
}
});
registerReceiver(notificationReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION));
}
/**
* Receives push Notifications
* */
private final BroadcastReceiver notificationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Waking up mobile if it is sleeping
WakeLocker.acquire(getApplicationContext());
/**
* Take some action upon receiving a push notification here!
**/
String message = intent.getExtras().getString(EXTRA_MESSAGE);
if (message == null) { message = "Empty Message"; }
| Log.i(TAG, message); |
apigee/apigee-android-sdk | samples/push/app/src/main/java/com/apigee/push/GCMIntentService.java | // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static void displayMessage(Context context, String message) {
// Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
// intent.putExtra(EXTRA_MESSAGE, message);
// context.sendBroadcast(intent);
// }
| import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.google.android.gcm.GCMBaseIntentService;
import static com.apigee.push.Settings.GCM_SENDER_ID;
import static com.apigee.push.Util.displayMessage; | package com.apigee.push;
public class GCMIntentService extends GCMBaseIntentService {
public GCMIntentService() {
super(GCM_SENDER_ID);
}
/**
* Method called on device registered
**/
@Override
protected void onRegistered(Context context, String registrationId) {
Log.i(TAG, "Device registered: " + registrationId); | // Path: samples/push/app/src/main/java/com/apigee/push/Util.java
// static void displayMessage(Context context, String message) {
// Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
// intent.putExtra(EXTRA_MESSAGE, message);
// context.sendBroadcast(intent);
// }
// Path: samples/push/app/src/main/java/com/apigee/push/GCMIntentService.java
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.google.android.gcm.GCMBaseIntentService;
import static com.apigee.push.Settings.GCM_SENDER_ID;
import static com.apigee.push.Util.displayMessage;
package com.apigee.push;
public class GCMIntentService extends GCMBaseIntentService {
public GCMIntentService() {
super(GCM_SENDER_ID);
}
/**
* Method called on device registered
**/
@Override
protected void onRegistered(Context context, String registrationId) {
Log.i(TAG, "Device registered: " + registrationId); | displayMessage(context, getString(R.string.gcm_registered, registrationId)); |
apigee/apigee-android-sdk | new-project-template/src/com/apigee/appservices/android_template/MainActivity.java | // Path: source/src/main/java/com/apigee/sdk/ApigeeClient.java
// public class ApigeeClient {
//
// /**
// * Default tag used for logging
// */
// public static final String LOGGING_TAG = "APIGEE_CLIENT";
// /**
// * Most current version of the Apigee Android SDK
// */
// public static final String SDK_VERSION = "2.0.14";
// /**
// * Platform type of this SDK
// */
// public static final String SDK_TYPE = "Android";
//
// private ApigeeDataClient dataClient;
// private ApigeeMonitoringClient monitoringClient;
// private AppIdentification appIdentification;
//
//
// /**
// * Instantiate client for a specific app.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, Context context) {
// this(organizationId,applicationId,null,null,context);
// }
//
// /**
// * Instantiate client for a specific app, and specify options for App Monitoring.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param monitoringOptions the options for application monitoring
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, MonitoringOptions monitoringOptions, Context context) {
// this(organizationId,applicationId,null,monitoringOptions,context);
// }
//
// /**
// * Instantiate client for a specific app, and specify an alternative baseURL for requests.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param baseURL the base URL to use for server communications
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, String baseURL, Context context) {
// this(organizationId,applicationId,baseURL,null,context);
// }
//
// /**
// * Instantiate client for a specific app, with an alternative baseURL for requests and options for
// * App Monitoring.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param baseURL the base URL to use for server communications
// * @param monitoringOptions the options for application monitoring
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, String baseURL, MonitoringOptions monitoringOptions, Context context) {
// appIdentification = new AppIdentification(organizationId,applicationId);
//
// boolean urlSpecified = false;
//
// if ((baseURL != null) && (baseURL.length() > 0)) {
// urlSpecified = true;
// appIdentification.setBaseURL(baseURL);
// } else {
// appIdentification.setBaseURL(ApigeeDataClient.PUBLIC_API_URL);
// }
//
// dataClient = new ApigeeDataClient(organizationId,applicationId,null,context);
// Log.d(LOGGING_TAG,"dataClient created");
//
// if (urlSpecified) {
// dataClient.setApiUrl(baseURL);
// }
//
// if ((monitoringOptions != null) && monitoringOptions.getMonitoringEnabled()) {
// monitoringClient = AppMon.initialize(appIdentification, dataClient, context, monitoringOptions);
// if( monitoringClient != null ) {
// Log.d(LOGGING_TAG,"monitoringClient created");
// ApigeeDataClient.setLogger(monitoringClient.getLogger());
// } else {
// Log.d(LOGGING_TAG,"unable to create monitoringClient");
// ApigeeDataClient.setLogger(new DefaultAndroidLog());
// }
// } else {
// monitoringClient = AppMon.initialize(appIdentification, dataClient, context, monitoringOptions);
// if( monitoringClient != null ) {
// Log.d(LOGGING_TAG,"monitoringClient created");
// ApigeeDataClient.setLogger(monitoringClient.getLogger());
// } else {
// Log.d(LOGGING_TAG,"unable to create monitoringClient");
// ApigeeDataClient.setLogger(new DefaultAndroidLog());
// }
// }
// }
//
// /**
// * Retrieve the instance of DataClient to use for data operations.
// *
// * @return DataClient object
// */
// public ApigeeDataClient getDataClient() {
// return dataClient;
// }
//
// /**
// * Retrieve the instance of MonitoringClient to use for App Monitoring operations.
// *
// * @return MonitoringClient object
// */
// public ApigeeMonitoringClient getMonitoringClient() {
// return monitoringClient;
// }
//
// /**
// * Retrieve the attributes that collectively identify the current application.
// *
// * @return AppIdentification object
// */
// public AppIdentification getAppIdentification() {
// return appIdentification;
// }
// }
| import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.apigee.fasterxml.jackson.databind.JsonNode;
import com.apigee.sdk.ApigeeClient;
import com.apigee.sdk.apm.android.Log;
import com.apigee.sdk.data.client.DataClient;
import com.apigee.sdk.data.client.callbacks.ApiResponseCallback;
import com.apigee.sdk.data.client.entities.Entity;
import com.apigee.sdk.data.client.response.ApiResponse;
import android.os.Bundle;
import android.app.Activity;
import android.widget.TextView; | package com.apigee.appservices.android_template;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView text = (TextView) findViewById(R.id.mainActivityText);
/*
1. Set your account details in the app
- Enter your ORGNAME below� it's the username you picked when you signed up at apigee.com
- Keep the APPNAME as 'sandbox': it's a context we automatically created for you.
It's completely open by default, but don't worry, other apps you create are not! */
String ORGNAME = "YOUR-ORG"; // <-- Put your username here!!!
String APPNAME = "sandbox";
| // Path: source/src/main/java/com/apigee/sdk/ApigeeClient.java
// public class ApigeeClient {
//
// /**
// * Default tag used for logging
// */
// public static final String LOGGING_TAG = "APIGEE_CLIENT";
// /**
// * Most current version of the Apigee Android SDK
// */
// public static final String SDK_VERSION = "2.0.14";
// /**
// * Platform type of this SDK
// */
// public static final String SDK_TYPE = "Android";
//
// private ApigeeDataClient dataClient;
// private ApigeeMonitoringClient monitoringClient;
// private AppIdentification appIdentification;
//
//
// /**
// * Instantiate client for a specific app.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, Context context) {
// this(organizationId,applicationId,null,null,context);
// }
//
// /**
// * Instantiate client for a specific app, and specify options for App Monitoring.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param monitoringOptions the options for application monitoring
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, MonitoringOptions monitoringOptions, Context context) {
// this(organizationId,applicationId,null,monitoringOptions,context);
// }
//
// /**
// * Instantiate client for a specific app, and specify an alternative baseURL for requests.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param baseURL the base URL to use for server communications
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, String baseURL, Context context) {
// this(organizationId,applicationId,baseURL,null,context);
// }
//
// /**
// * Instantiate client for a specific app, with an alternative baseURL for requests and options for
// * App Monitoring.
// *
// * @param organizationId the organization id or name
// * @param applicationId the application id or name
// * @param baseURL the base URL to use for server communications
// * @param monitoringOptions the options for application monitoring
// * @param context the Android context
// */
// public ApigeeClient(String organizationId, String applicationId, String baseURL, MonitoringOptions monitoringOptions, Context context) {
// appIdentification = new AppIdentification(organizationId,applicationId);
//
// boolean urlSpecified = false;
//
// if ((baseURL != null) && (baseURL.length() > 0)) {
// urlSpecified = true;
// appIdentification.setBaseURL(baseURL);
// } else {
// appIdentification.setBaseURL(ApigeeDataClient.PUBLIC_API_URL);
// }
//
// dataClient = new ApigeeDataClient(organizationId,applicationId,null,context);
// Log.d(LOGGING_TAG,"dataClient created");
//
// if (urlSpecified) {
// dataClient.setApiUrl(baseURL);
// }
//
// if ((monitoringOptions != null) && monitoringOptions.getMonitoringEnabled()) {
// monitoringClient = AppMon.initialize(appIdentification, dataClient, context, monitoringOptions);
// if( monitoringClient != null ) {
// Log.d(LOGGING_TAG,"monitoringClient created");
// ApigeeDataClient.setLogger(monitoringClient.getLogger());
// } else {
// Log.d(LOGGING_TAG,"unable to create monitoringClient");
// ApigeeDataClient.setLogger(new DefaultAndroidLog());
// }
// } else {
// monitoringClient = AppMon.initialize(appIdentification, dataClient, context, monitoringOptions);
// if( monitoringClient != null ) {
// Log.d(LOGGING_TAG,"monitoringClient created");
// ApigeeDataClient.setLogger(monitoringClient.getLogger());
// } else {
// Log.d(LOGGING_TAG,"unable to create monitoringClient");
// ApigeeDataClient.setLogger(new DefaultAndroidLog());
// }
// }
// }
//
// /**
// * Retrieve the instance of DataClient to use for data operations.
// *
// * @return DataClient object
// */
// public ApigeeDataClient getDataClient() {
// return dataClient;
// }
//
// /**
// * Retrieve the instance of MonitoringClient to use for App Monitoring operations.
// *
// * @return MonitoringClient object
// */
// public ApigeeMonitoringClient getMonitoringClient() {
// return monitoringClient;
// }
//
// /**
// * Retrieve the attributes that collectively identify the current application.
// *
// * @return AppIdentification object
// */
// public AppIdentification getAppIdentification() {
// return appIdentification;
// }
// }
// Path: new-project-template/src/com/apigee/appservices/android_template/MainActivity.java
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.apigee.fasterxml.jackson.databind.JsonNode;
import com.apigee.sdk.ApigeeClient;
import com.apigee.sdk.apm.android.Log;
import com.apigee.sdk.data.client.DataClient;
import com.apigee.sdk.data.client.callbacks.ApiResponseCallback;
import com.apigee.sdk.data.client.entities.Entity;
import com.apigee.sdk.data.client.response.ApiResponse;
import android.os.Bundle;
import android.app.Activity;
import android.widget.TextView;
package com.apigee.appservices.android_template;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView text = (TextView) findViewById(R.id.mainActivityText);
/*
1. Set your account details in the app
- Enter your ORGNAME below� it's the username you picked when you signed up at apigee.com
- Keep the APPNAME as 'sandbox': it's a context we automatically created for you.
It's completely open by default, but don't worry, other apps you create are not! */
String ORGNAME = "YOUR-ORG"; // <-- Put your username here!!!
String APPNAME = "sandbox";
| ApigeeClient apigeeClient = new ApigeeClient(ORGNAME,APPNAME,this.getBaseContext()); |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/results/RunResults.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/NodeMode.java
// public enum NodeMode {
// BIT(SerializationConstants.BIT_TYPE_STR, BitValue.class),BYTE(SerializationConstants.BYTE_TYPE_STR, ByteValue.class);
//
// public final String typeStr;
// public final Class<? extends Value> typeClass;
//
// NodeMode(String typeStr, Class<? extends Value> typeClass){
// this.typeStr = typeStr;
// this.typeClass = typeClass;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
| import com.ebp.owat.lib.datastructure.value.NodeMode;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map; | package com.ebp.owat.lib.runner.utils.results;
/**
* Results of a run, keeps information about it for reporting.
*
* This is the abstract class to genericize data kept by both types of run (scrambling/descrambling)
*/
public abstract class RunResults {
private static final Logger LOGGER = LoggerFactory.getLogger(RunResults.class);
/**
* Constructor to set the scrambleMode of this scramble scrambleMode
* @param scrambleMode The scrambleMode of this run.
*/ | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/NodeMode.java
// public enum NodeMode {
// BIT(SerializationConstants.BIT_TYPE_STR, BitValue.class),BYTE(SerializationConstants.BYTE_TYPE_STR, ByteValue.class);
//
// public final String typeStr;
// public final Class<? extends Value> typeClass;
//
// NodeMode(String typeStr, Class<? extends Value> typeClass){
// this.typeStr = typeStr;
// this.typeClass = typeClass;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/results/RunResults.java
import com.ebp.owat.lib.datastructure.value.NodeMode;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
package com.ebp.owat.lib.runner.utils.results;
/**
* Results of a run, keeps information about it for reporting.
*
* This is the abstract class to genericize data kept by both types of run (scrambling/descrambling)
*/
public abstract class RunResults {
private static final Logger LOGGER = LoggerFactory.getLogger(RunResults.class);
/**
* Constructor to set the scrambleMode of this scramble scrambleMode
* @param scrambleMode The scrambleMode of this run.
*/ | public RunResults(ScrambleMode scrambleMode){ |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/results/RunResults.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/NodeMode.java
// public enum NodeMode {
// BIT(SerializationConstants.BIT_TYPE_STR, BitValue.class),BYTE(SerializationConstants.BYTE_TYPE_STR, ByteValue.class);
//
// public final String typeStr;
// public final Class<? extends Value> typeClass;
//
// NodeMode(String typeStr, Class<? extends Value> typeClass){
// this.typeStr = typeStr;
// this.typeClass = typeClass;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
| import com.ebp.owat.lib.datastructure.value.NodeMode;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map; | package com.ebp.owat.lib.runner.utils.results;
/**
* Results of a run, keeps information about it for reporting.
*
* This is the abstract class to genericize data kept by both types of run (scrambling/descrambling)
*/
public abstract class RunResults {
private static final Logger LOGGER = LoggerFactory.getLogger(RunResults.class);
/**
* Constructor to set the scrambleMode of this scramble scrambleMode
* @param scrambleMode The scrambleMode of this run.
*/
public RunResults(ScrambleMode scrambleMode){
this.scrambleMode = scrambleMode;
if(this.scrambleMode == ScrambleMode.SCRAMBLING){ | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/NodeMode.java
// public enum NodeMode {
// BIT(SerializationConstants.BIT_TYPE_STR, BitValue.class),BYTE(SerializationConstants.BYTE_TYPE_STR, ByteValue.class);
//
// public final String typeStr;
// public final Class<? extends Value> typeClass;
//
// NodeMode(String typeStr, Class<? extends Value> typeClass){
// this.typeStr = typeStr;
// this.typeClass = typeClass;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/results/RunResults.java
import com.ebp.owat.lib.datastructure.value.NodeMode;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
package com.ebp.owat.lib.runner.utils.results;
/**
* Results of a run, keeps information about it for reporting.
*
* This is the abstract class to genericize data kept by both types of run (scrambling/descrambling)
*/
public abstract class RunResults {
private static final Logger LOGGER = LoggerFactory.getLogger(RunResults.class);
/**
* Constructor to set the scrambleMode of this scramble scrambleMode
* @param scrambleMode The scrambleMode of this run.
*/
public RunResults(ScrambleMode scrambleMode){
this.scrambleMode = scrambleMode;
if(this.scrambleMode == ScrambleMode.SCRAMBLING){ | this.curStep = Step.NOT_STARTED_SCRAMBLE; |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/results/RunResults.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/NodeMode.java
// public enum NodeMode {
// BIT(SerializationConstants.BIT_TYPE_STR, BitValue.class),BYTE(SerializationConstants.BYTE_TYPE_STR, ByteValue.class);
//
// public final String typeStr;
// public final Class<? extends Value> typeClass;
//
// NodeMode(String typeStr, Class<? extends Value> typeClass){
// this.typeStr = typeStr;
// this.typeClass = typeClass;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
| import com.ebp.owat.lib.datastructure.value.NodeMode;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map; | package com.ebp.owat.lib.runner.utils.results;
/**
* Results of a run, keeps information about it for reporting.
*
* This is the abstract class to genericize data kept by both types of run (scrambling/descrambling)
*/
public abstract class RunResults {
private static final Logger LOGGER = LoggerFactory.getLogger(RunResults.class);
/**
* Constructor to set the scrambleMode of this scramble scrambleMode
* @param scrambleMode The scrambleMode of this run.
*/
public RunResults(ScrambleMode scrambleMode){
this.scrambleMode = scrambleMode;
if(this.scrambleMode == ScrambleMode.SCRAMBLING){
this.curStep = Step.NOT_STARTED_SCRAMBLE;
}
if(this.scrambleMode == ScrambleMode.DESCRAMBLING){
this.curStep = Step.NOT_STARTED_DESCRAMBLE;
}
}
/**
* Constructor to setup the scramble and node modes.
* @param scrambleMode The scramble mode of this run.
* @param nodeMode The node mode of this run.
*/ | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/NodeMode.java
// public enum NodeMode {
// BIT(SerializationConstants.BIT_TYPE_STR, BitValue.class),BYTE(SerializationConstants.BYTE_TYPE_STR, ByteValue.class);
//
// public final String typeStr;
// public final Class<? extends Value> typeClass;
//
// NodeMode(String typeStr, Class<? extends Value> typeClass){
// this.typeStr = typeStr;
// this.typeClass = typeClass;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/results/RunResults.java
import com.ebp.owat.lib.datastructure.value.NodeMode;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
package com.ebp.owat.lib.runner.utils.results;
/**
* Results of a run, keeps information about it for reporting.
*
* This is the abstract class to genericize data kept by both types of run (scrambling/descrambling)
*/
public abstract class RunResults {
private static final Logger LOGGER = LoggerFactory.getLogger(RunResults.class);
/**
* Constructor to set the scrambleMode of this scramble scrambleMode
* @param scrambleMode The scrambleMode of this run.
*/
public RunResults(ScrambleMode scrambleMode){
this.scrambleMode = scrambleMode;
if(this.scrambleMode == ScrambleMode.SCRAMBLING){
this.curStep = Step.NOT_STARTED_SCRAMBLE;
}
if(this.scrambleMode == ScrambleMode.DESCRAMBLING){
this.curStep = Step.NOT_STARTED_DESCRAMBLE;
}
}
/**
* Constructor to setup the scramble and node modes.
* @param scrambleMode The scramble mode of this run.
* @param nodeMode The node mode of this run.
*/ | public RunResults(ScrambleMode scrambleMode, NodeMode nodeMode) { |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
| import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class }, | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java
import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class }, | { OwatStructureException.class }, |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
| import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class }, | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java
import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class }, | { OwatMatrixException.class }, |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
| import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class }, | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java
import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class }, | { OwatValueException.class }, |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
| import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class }, | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java
import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class }, | { OwatSetException.class }, |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
| import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class },
{ OwatSetException.class }, | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java
import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class },
{ OwatSetException.class }, | { OwatUtilException.class }, |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
| import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class },
{ OwatSetException.class },
{ OwatUtilException.class }, | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java
import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class },
{ OwatSetException.class },
{ OwatUtilException.class }, | { OwatRandException.class }, |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
| import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals; | package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class },
{ OwatSetException.class },
{ OwatUtilException.class },
{ OwatRandException.class }, | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/OwatStructureException.java
// public class OwatStructureException extends OwatException {
// public OwatStructureException() {super();}
//
// public OwatStructureException(String s) {
// super(s);
// }
//
// public OwatStructureException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatStructureException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/OwatMatrixException.java
// public class OwatMatrixException extends OwatStructureException {
// public OwatMatrixException() {super();}
//
// public OwatMatrixException(String s) {
// super(s);
// }
//
// public OwatMatrixException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/matrix/utils/OwatMatrixUtilException.java
// public class OwatMatrixUtilException extends OwatMatrixException {
// public OwatMatrixUtilException() {super();}
//
// public OwatMatrixUtilException(String s) {
// super(s);
// }
//
// public OwatMatrixUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatMatrixUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/value/OwatValueException.java
// public class OwatValueException extends OwatStructureException{
// public OwatValueException() {super();}
//
// public OwatValueException(String s) {
// super(s);
// }
//
// public OwatValueException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatValueException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/datastructure/set/OwatSetException.java
// public class OwatSetException extends OwatValueException {
// public OwatSetException() {super();}
//
// public OwatSetException(String s) {
// super(s);
// }
//
// public OwatSetException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatSetException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/OwatUtilException.java
// public class OwatUtilException extends OwatException {
// public OwatUtilException() {super();}
//
// public OwatUtilException(String s) {
// super(s);
// }
//
// public OwatUtilException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatUtilException(Throwable throwable) {
// super(throwable);
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/utils/rand/OwatRandException.java
// public class OwatRandException extends OwatUtilException {
// public OwatRandException() {super();}
//
// public OwatRandException(String s) {
// super(s);
// }
//
// public OwatRandException(String s, Throwable throwable) {
// super(s, throwable);
// }
//
// public OwatRandException(Throwable throwable) {
// super(throwable);
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/ExceptionTests.java
import com.ebp.owat.lib.datastructure.OwatStructureException;
import com.ebp.owat.lib.datastructure.matrix.OwatMatrixException;
import com.ebp.owat.lib.datastructure.matrix.utils.OwatMatrixUtilException;
import com.ebp.owat.lib.datastructure.value.OwatValueException;
import com.ebp.owat.lib.datastructure.set.OwatSetException;
import com.ebp.owat.lib.utils.OwatUtilException;
import com.ebp.owat.lib.utils.rand.OwatRandException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
package com.ebp.owat.lib;
@RunWith(Parameterized.class)
public class ExceptionTests {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTests.class);
/** The different exceptions to test. */
@Parameterized.Parameters
public static Collection exceptionsToTest() {
return Arrays.asList(new Object[][] {
{ OwatException.class },
{ OwatStructureException.class },
{ OwatMatrixException.class },
{ OwatValueException.class },
{ OwatSetException.class },
{ OwatUtilException.class },
{ OwatRandException.class }, | { OwatMatrixUtilException.class } |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/runner/utilities/RunnerStepTest.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
| import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.junit.Test;
import java.util.Collection;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; | package com.ebp.owat.lib.runner.utilities;
public class RunnerStepTest {
@Test
public void testGetStepsIn(){ | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/runner/utilities/RunnerStepTest.java
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.junit.Test;
import java.util.Collection;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
package com.ebp.owat.lib.runner.utilities;
public class RunnerStepTest {
@Test
public void testGetStepsIn(){ | Collection<Step> stepsIn = Step.getStepsIn(ScrambleMode.DESCRAMBLING); |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/runner/utilities/RunnerStepTest.java | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
| import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.junit.Test;
import java.util.Collection;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; | package com.ebp.owat.lib.runner.utilities;
public class RunnerStepTest {
@Test
public void testGetStepsIn(){ | // Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/ScrambleMode.java
// public enum ScrambleMode {
// SCRAMBLING("scrambling", 5),
// DESCRAMBLING("scrambling", 4);
//
// /** The name of the mode */
// public final String name;
// /** The number of steps in the mode. */
// public final long numSteps;
//
// ScrambleMode(String name, long numSteps){
// this.name = name;
// this.numSteps = numSteps;
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/Step.java
// public enum Step {
// NOT_STARTED_SCRAMBLE(0, "Not Started", ScrambleMode.SCRAMBLING),
// NOT_STARTED_DESCRAMBLE(0, "Not Started", ScrambleMode.DESCRAMBLING),
//
// LOAD_DATA(1, "Loading Data", ScrambleMode.SCRAMBLING),
// PAD_DATA(2, "Padding Data", ScrambleMode.SCRAMBLING),
// SCRAMBLING(3, "Scrambling", ScrambleMode.SCRAMBLING),
// OUT_SCRAMBLED_DATA(4, "Outputting Scrambled Data", ScrambleMode.SCRAMBLING),
// OUT_KEY(5, "Outputting key", ScrambleMode.SCRAMBLING),
// DONE_SCRAMBLING(6, "Done", ScrambleMode.SCRAMBLING),
//
// LOAD_KEY(1, "Loading Key", ScrambleMode.DESCRAMBLING),
// LOAD_SCRAMBLED_DATA(2, "Loading Scrambled Data", ScrambleMode.DESCRAMBLING),
// DESCRAMBLING(3, "Descrambling", ScrambleMode.DESCRAMBLING),
// OUT_DESCRAMBLED_DATA(4, "Outputting Descrambled Data", ScrambleMode.DESCRAMBLING),
// DONE_DESCRAMBLING(5, "Done", ScrambleMode.DESCRAMBLING);
//
// /** The step number of the step. */
// public final int stepNo;
// /** The name of the step. */
// public final String stepName;
// /** The mode the step is part of. */
// public final ScrambleMode mode;
//
// Step(int stepNo, String name, ScrambleMode mode){
// this.stepNo = stepNo;
// this.stepName = name;
// this.mode = mode;
// }
//
// /**
// * Gets the steps that are part of a mode.
// * @param mode The mode to get the steps of
// * @return The list of steps in the mode.
// */
// public static List<Step> getStepsIn(ScrambleMode mode){
// List<Step> steps = new LinkedList<>();
//
// for(Step curStep : Step.values()){
// if(
// curStep == NOT_STARTED_SCRAMBLE ||
// curStep == NOT_STARTED_DESCRAMBLE ||
// curStep == DONE_DESCRAMBLING ||
// curStep == DONE_SCRAMBLING
// ){
// continue;
// }
// if(curStep.mode == mode){
// steps.add(curStep);
// }
// }
// return steps;
// }
// }
// Path: implementations/java/OWAT-lib/src/test/java/com/ebp/owat/lib/runner/utilities/RunnerStepTest.java
import com.ebp.owat.lib.runner.utils.ScrambleMode;
import com.ebp.owat.lib.runner.utils.Step;
import org.junit.Test;
import java.util.Collection;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
package com.ebp.owat.lib.runner.utilities;
public class RunnerStepTest {
@Test
public void testGetStepsIn(){ | Collection<Step> stepsIn = Step.getStepsIn(ScrambleMode.DESCRAMBLING); |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/config/CommandLineOps.java | // Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
| import com.ebp.owat.app.InputValidator;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.ebp.owat.app.InputValidator.*; | package com.ebp.owat.app.config;
/**
* Processes command line options for the program.
*
* TODO:: add ability to specify key data in the argument
*/
public class CommandLineOps {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandLineOps.class);
private final String[] argsGotten;
@Option(name="-m", aliases={"--mode"}, usage="The mode that this will run with. Required. ", required = true)
private RunMode runMode = null;
@Option(name="-i", aliases={"--input"}, usage="Input data straight from the command line.")
private String inputString = null;
@Option(name="-f", aliases={"--input-file"}, usage="Input data from a file.")
private File inputFile = null;
@Option(name = "-o", aliases = {"--output-file"}, usage = "Where to output the data.")
private File dataOutputFile = null;
@Option(name = "-k", aliases = {"--key-file"}, usage = "The key file.")
private File keyFile = null;
@Option(name = "-c", aliases = {"--csv-stats"}, usage = "For outputting timing data to a CSV file.")
private File csvFile = null;
@Option(name = "--matrix-mode", usage = "For specifying a specific matrix type to use.") | // Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/config/CommandLineOps.java
import com.ebp.owat.app.InputValidator;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.ebp.owat.app.InputValidator.*;
package com.ebp.owat.app.config;
/**
* Processes command line options for the program.
*
* TODO:: add ability to specify key data in the argument
*/
public class CommandLineOps {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandLineOps.class);
private final String[] argsGotten;
@Option(name="-m", aliases={"--mode"}, usage="The mode that this will run with. Required. ", required = true)
private RunMode runMode = null;
@Option(name="-i", aliases={"--input"}, usage="Input data straight from the command line.")
private String inputString = null;
@Option(name="-f", aliases={"--input-file"}, usage="Input data from a file.")
private File inputFile = null;
@Option(name = "-o", aliases = {"--output-file"}, usage = "Where to output the data.")
private File dataOutputFile = null;
@Option(name = "-k", aliases = {"--key-file"}, usage = "The key file.")
private File keyFile = null;
@Option(name = "-c", aliases = {"--csv-stats"}, usage = "For outputting timing data to a CSV file.")
private File csvFile = null;
@Option(name = "--matrix-mode", usage = "For specifying a specific matrix type to use.") | private MatrixMode matrixMode = null; |
Epic-Breakfast-Productions/OWAT | implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/config/CommandLineOps.java | // Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
| import com.ebp.owat.app.InputValidator;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.ebp.owat.app.InputValidator.*; | System.out.println("Available options:");
parser.printUsage(System.out);
System.exit(0);
}
this.ensureReadyForRun();
} catch( CmdLineException|IllegalArgumentException e ) {
System.err.println("Error parsing arguments:");
System.err.println("\t"+e.getMessage());
System.err.println("");
// print the list of available options
System.err.println("Available options:");
parser.printUsage(System.err);
System.err.println();
System.exit(1);
}
}
public boolean outputCsvStats(){
return this.csvFile == null;
}
private void ensureHaveInputData() throws IllegalArgumentException {
if(this.inputString == null && this.inputFile == null){
throw new IllegalArgumentException("No input data given. Cannot continue.");
}
if(this.inputString != null && this.inputFile != null){
throw new IllegalArgumentException("Got both a input file and string. Don't know which to use.");
}
if(this.inputFile != null){ | // Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
//
// Path: implementations/java/OWAT-lib/src/main/java/com/ebp/owat/lib/runner/utils/MatrixMode.java
// public enum MatrixMode {
// HASHED("hashed"),
// LINKED("linked"),
// ARRAY("array");
//
// public final String name;
//
// MatrixMode(String name){
// this.name = name;
// }
//
// /**
// * Determines which matrix type to use based on the number of elements in the set to hold.
// * @param n The number of elements to hold
// * @return The matrix mode best to use.
// */
// public static MatrixMode determineModeToUse(long n){
// return ARRAY;//allways the most efficient, https://github.com/Epic-Breakfast-Productions/OWAT/blob/master/implementations/java/Matrix%20Implementation%20Analysis/OWAT_Matrix_Implementation_Analysis.md
// }
// }
//
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/InputValidator.java
// public class InputValidator {
// public static final String DESC_SCRAMBLED_DATA_OUTPUT = "scrambled data output file";
// public static final String DESC_SCRAMBLED_DATA_INPUT = "scrambled data input file";
// public static final String DESC_SCRAMBLE_DATA_INPUT = "scrambled data input file";
// public static final String DESC_DESCRAMBLED_DATA_OUTPUT = "descrambled data output file";
// public static final String DESC_KEY = "key file";
// public static final String CSV_FILE = "csv stats file";
//
// //TODO:: rework these to better handle files, using the validation methods in MainGuiApp
//
// public static void ensureCanWriteToFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given already exists.");
// }
// }
//
// public static void ensureCanReadFromFile(File file, String description) throws IllegalArgumentException {
// if(file == null){
// throw new IllegalArgumentException("No "+ description +" given. Cannot continue.");
// }
// if(!file.exists()){
// throw new IllegalArgumentException(description +" ("+file.getPath()+") given does not exist.");
// }
// }
// }
// Path: implementations/java/OWAT-app/src/main/java/com/ebp/owat/app/config/CommandLineOps.java
import com.ebp.owat.app.InputValidator;
import com.ebp.owat.lib.runner.utils.MatrixMode;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.ebp.owat.app.InputValidator.*;
System.out.println("Available options:");
parser.printUsage(System.out);
System.exit(0);
}
this.ensureReadyForRun();
} catch( CmdLineException|IllegalArgumentException e ) {
System.err.println("Error parsing arguments:");
System.err.println("\t"+e.getMessage());
System.err.println("");
// print the list of available options
System.err.println("Available options:");
parser.printUsage(System.err);
System.err.println();
System.exit(1);
}
}
public boolean outputCsvStats(){
return this.csvFile == null;
}
private void ensureHaveInputData() throws IllegalArgumentException {
if(this.inputString == null && this.inputFile == null){
throw new IllegalArgumentException("No input data given. Cannot continue.");
}
if(this.inputString != null && this.inputFile != null){
throw new IllegalArgumentException("Got both a input file and string. Don't know which to use.");
}
if(this.inputFile != null){ | InputValidator.ensureCanReadFromFile(this.inputFile, DESC_SCRAMBLE_DATA_INPUT); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.