From abb67a9b0b84ea49be0f363d2d06653dc349203a Mon Sep 17 00:00:00 2001 From: serso Date: Sun, 28 Feb 2016 23:50:31 +0100 Subject: [PATCH] Remove unused classes --- .../CalculatorConversionEventData.java | 49 --------- .../CalculatorEvaluationEventData.java | 41 ------- .../CalculatorEvaluationEventDataImpl.java | 95 ---------------- .../calculator/CalculatorEventData.java | 50 --------- .../calculator/CalculatorEventDataImpl.java | 102 ------------------ .../calculator/CalculatorEventHolder.java | 100 ----------------- 6 files changed, 437 deletions(-) delete mode 100644 app/src/main/java/org/solovyev/android/calculator/CalculatorConversionEventData.java delete mode 100644 app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java delete mode 100644 app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java delete mode 100644 app/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java delete mode 100644 app/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java delete mode 100644 app/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorConversionEventData.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorConversionEventData.java deleted file mode 100644 index 2a8bd5b3..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorConversionEventData.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import javax.annotation.Nonnull; - -import jscl.NumeralBase; -import jscl.math.Generic; - -/** - * User: Solovyev_S - * Date: 24.09.12 - * Time: 16:45 - */ -public interface CalculatorConversionEventData extends CalculatorEventData { - - // display state on the moment of conversion - @Nonnull - DisplayState getDisplayState(); - - @Nonnull - NumeralBase getFromNumeralBase(); - - @Nonnull - NumeralBase getToNumeralBase(); - - @Nonnull - Generic getValue(); -} diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java deleted file mode 100644 index c376813d..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventData.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import org.solovyev.android.calculator.jscl.JsclOperation; - -import javax.annotation.Nonnull; - -/** - * User: serso - * Date: 9/20/12 - * Time: 10:00 PM - */ -public interface CalculatorEvaluationEventData extends CalculatorEventData { - - @Nonnull - JsclOperation getOperation(); - - @Nonnull - String getExpression(); -} diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java deleted file mode 100644 index da50cc74..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorEvaluationEventDataImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import org.solovyev.android.calculator.jscl.JsclOperation; - -import javax.annotation.Nonnull; - -/** - * User: serso - * Date: 9/20/12 - * Time: 10:01 PM - */ -public class CalculatorEvaluationEventDataImpl implements CalculatorEvaluationEventData { - - @Nonnull - private final CalculatorEventData calculatorEventData; - - @Nonnull - private final JsclOperation operation; - - @Nonnull - private final String expression; - - public CalculatorEvaluationEventDataImpl(@Nonnull CalculatorEventData calculatorEventData, - @Nonnull JsclOperation operation, - @Nonnull String expression) { - this.calculatorEventData = calculatorEventData; - this.operation = operation; - this.expression = expression; - } - - @Nonnull - @Override - public JsclOperation getOperation() { - return this.operation; - } - - @Nonnull - @Override - public String getExpression() { - return this.expression; - } - - @Override - public long getEventId() { - return calculatorEventData.getEventId(); - } - - @Nonnull - @Override - public Long getSequenceId() { - return calculatorEventData.getSequenceId(); - } - - @Override - public Object getSource() { - return calculatorEventData.getSource(); - } - - @Override - public boolean isAfter(@Nonnull CalculatorEventData that) { - return calculatorEventData.isAfter(that); - } - - @Override - public boolean isSameSequence(@Nonnull CalculatorEventData that) { - return this.calculatorEventData.isSameSequence(that); - } - - @Override - public boolean isAfterSequence(@Nonnull CalculatorEventData that) { - return this.calculatorEventData.isAfterSequence(that); - } -} diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java deleted file mode 100644 index e1bd4d39..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorEventData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -/** - * User: Solovyev_S - * Date: 20.09.12 - * Time: 18:18 - */ -public interface CalculatorEventData { - - // the higher id => the later event - long getEventId(); - - // the higher id => the later event - @Nonnull - Long getSequenceId(); - - @Nullable - Object getSource(); - - boolean isAfter(@Nonnull CalculatorEventData that); - - boolean isSameSequence(@Nonnull CalculatorEventData that); - - boolean isAfterSequence(@Nonnull CalculatorEventData that); -} diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java deleted file mode 100644 index 6d59889a..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorEventDataImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -class CalculatorEventDataImpl implements CalculatorEventData { - - private static final long NO_SEQUENCE = -1L; - - private final long eventId; - private final Object source; - private final long sequenceId; - - private CalculatorEventDataImpl(long id, long sequenceId, @Nullable Object source) { - this.eventId = id; - this.sequenceId = sequenceId; - this.source = source; - } - - @Nonnull - static CalculatorEventData newInstance(long id, long sequenceId) { - return new CalculatorEventDataImpl(id, sequenceId, null); - } - - @Override - public long getEventId() { - return this.eventId; - } - - @Nonnull - @Override - public Long getSequenceId() { - return this.sequenceId; - } - - @Override - public Object getSource() { - return this.source; - } - - @Override - public boolean isAfter(@Nonnull CalculatorEventData that) { - return this.eventId > that.getEventId(); - } - - @Override - public boolean isSameSequence(@Nonnull CalculatorEventData that) { - if (this.sequenceId == NO_SEQUENCE) { - return false; - } - return this.sequenceId == that.getSequenceId(); - } - - @Override - public boolean isAfterSequence(@Nonnull CalculatorEventData that) { - if (this.sequenceId == NO_SEQUENCE) { - return false; - } - return this.sequenceId > that.getSequenceId(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof CalculatorEventDataImpl)) return false; - - CalculatorEventDataImpl that = (CalculatorEventDataImpl) o; - - if (eventId != that.eventId) return false; - return sequenceId == that.sequenceId; - - } - - @Override - public int hashCode() { - int result = (int) (eventId ^ (eventId >>> 32)); - result = 31 * result + (int) (sequenceId ^ (sequenceId >>> 32)); - return result; - } -} diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java deleted file mode 100644 index bc1efadd..00000000 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorEventHolder.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.calculator; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -/** - * User: serso - * Date: 10/9/12 - * Time: 9:59 PM - */ -public class CalculatorEventHolder { - - @Nonnull - private volatile CalculatorEventData lastEventData; - - public CalculatorEventHolder(@Nonnull CalculatorEventData lastEventData) { - this.lastEventData = lastEventData; - } - - @Nonnull - public synchronized CalculatorEventData getLastEventData() { - return lastEventData; - } - - @Nonnull - public synchronized Result apply(@Nonnull CalculatorEventData newEventData) { - final Result result = new Result(lastEventData, newEventData); - - if (result.isNewAfter()) { - this.lastEventData = newEventData; - } - - return result; - } - - public static class Result { - - @Nonnull - private final CalculatorEventData lastEventData; - - @Nonnull - private final CalculatorEventData newEventData; - - @Nullable - private Boolean after = null; - - @Nullable - private Boolean sameSequence = null; - - public Result(@Nonnull CalculatorEventData lastEventData, - @Nonnull CalculatorEventData newEventData) { - this.lastEventData = lastEventData; - this.newEventData = newEventData; - } - - public boolean isNewAfter() { - if (after == null) { - after = newEventData.isAfter(lastEventData); - } - return after; - } - - public boolean isSameSequence() { - if (sameSequence == null) { - sameSequence = newEventData.isSameSequence(lastEventData); - } - return sameSequence; - } - - public boolean isNewAfterSequence() { - return newEventData.isAfterSequence(lastEventData); - } - - public boolean isNewSameOrAfterSequence() { - return isSameSequence() || isNewAfterSequence(); - } - } -}