Remove unused classes
This commit is contained in:
parent
d1d6ab62dd
commit
abb67a9b0b
@ -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();
|
|
||||||
}
|
|
@ -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();
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user