Skip to content

Commit

Permalink
Deprecate GSC variant APIs and add EC variant APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
itohro committed Apr 2, 2017
1 parent cf21587 commit 44456e0
Show file tree
Hide file tree
Showing 110 changed files with 1,709 additions and 76 deletions.
14 changes: 14 additions & 0 deletions reladomo/src/main/java/com/gs/fw/common/mithra/AggregateData.java
Expand Up @@ -72,6 +72,11 @@ public void setValues(Object[] values)
this.values = values;
}

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
public void setNameToPositionMap(ObjectIntHashMap map)
{
if (this.config == null)
Expand All @@ -81,6 +86,15 @@ public void setNameToPositionMap(ObjectIntHashMap map)
this.config.setNameToPositionMap(map);
}

public void setNameToPositionMap(org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap map)
{
if (this.config == null)
{
this.config = new AggregateDataConfig();
}
this.config.setNameToPositionMap(map);
}

public Object getValue(String name)
{
return this.config.getObjectValueForName(name, values);
Expand Down
Expand Up @@ -42,6 +42,7 @@
public class AggregateDataConfig implements Serializable
{
private ObjectIntHashMap<String> nameToPositionMap;
private ObjectIntHashMap<String> nameToPositionMapEc;
private List<MithraGroupByAttribute> groupByAttributes;
private List<MithraAggregateAttribute> aggregateAttributes;
private static final byte NULL_VALUE = 100;
Expand Down Expand Up @@ -80,6 +81,11 @@ public int getAttributeCount()
return nameToPositionMap.size();
}

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
public void setNameToPositionMap(ObjectIntHashMap<String> map)
{
this.nameToPositionMap = new ObjectIntHashMap(map.size());
Expand All @@ -93,6 +99,19 @@ public void value(String each, int parameter)
});
}

public void setNameToPositionMap(org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<String> map)
{
this.nameToPositionMap = new ObjectIntHashMap(map.size());
map.forEachKeyValue(new org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure<String>()
{
@Override
public void value(String each, int parameter)
{
nameToPositionMap.put(each, parameter);
}
});
}

public int getIndexForName(String name)
{
return this.nameToPositionMap.get(name);
Expand Down
15 changes: 15 additions & 0 deletions reladomo/src/main/java/com/gs/fw/common/mithra/AggregateList.java
Expand Up @@ -74,6 +74,11 @@ public Set getAttributeAsSet(String attributeName)
return result;
}

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
public MutableIntSet getAttributeAsGscIntSet(String attributeName)
{
MutableIntSet result = new IntHashSet(this.size());
Expand All @@ -84,6 +89,16 @@ public MutableIntSet getAttributeAsGscIntSet(String attributeName)
return result;
}

public org.eclipse.collections.api.set.primitive.MutableIntSet getAttributeAsEcIntSet(String attributeName)
{
org.eclipse.collections.api.set.primitive.MutableIntSet result = new org.eclipse.collections.impl.set.mutable.primitive.IntHashSet(this.size());
for (int i = 0; i < this.size(); i++)
{
result.add(this.get(i).getAttributeAsInt(attributeName));
}
return result;
}

private void validateAttribute(MithraObjectPortal portal)
{
checkResolved();
Expand Down
26 changes: 26 additions & 0 deletions reladomo/src/main/java/com/gs/fw/common/mithra/UnifiedMap.java
@@ -0,0 +1,26 @@
package com.gs.fw.common.mithra;

import org.eclipse.collections.api.map.MutableMap;

public class UnifiedMap<K, V> extends org.eclipse.collections.impl.map.mutable.UnifiedMap<K, V> implements MutableMap<K, V>
{
public UnifiedMap()
{
super();
}

public UnifiedMap(int initialCapacity)
{
super(initialCapacity, 0.75F);
}

public static <K, V> UnifiedMap<K, V> newMap()
{
return new UnifiedMap<K, V>();
}

public static <K, V> UnifiedMap<K, V> newMap(int initialCapacity)
{
return new UnifiedMap<K, V>(initialCapacity);
}
}
Expand Up @@ -17,7 +17,6 @@

package com.gs.fw.common.mithra.attribute;

import com.gs.collections.api.block.function.Function;
import com.gs.fw.common.mithra.AggregateData;
import com.gs.fw.common.mithra.MithraAggregateAttribute;
import com.gs.fw.common.mithra.MithraDataObject;
Expand All @@ -32,6 +31,7 @@
import com.gs.fw.common.mithra.extractor.OffHeapableExtractor;
import com.gs.fw.common.mithra.finder.*;
import com.gs.fw.common.mithra.finder.orderby.OrderBy;
import com.gs.fw.common.mithra.util.Function;
import com.gs.fw.common.mithra.util.InternalList;
import com.gs.fw.common.mithra.util.Nullable;

Expand Down
Expand Up @@ -16,7 +16,6 @@

package com.gs.fw.common.mithra.attribute;

import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.set.primitive.DoubleSet;
import com.gs.fw.common.mithra.aggregate.attribute.DoubleAggregateAttribute;
import com.gs.fw.common.mithra.attribute.calculator.aggregateFunction.StandardDeviationCalculatorNumeric;
Expand Down Expand Up @@ -161,10 +160,24 @@ public Operation nonPrimitiveEq(Object other)

public abstract Operation notEq(double other);

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
public abstract Operation in(DoubleSet doubleSet);

public abstract Operation in(org.eclipse.collections.api.set.primitive.DoubleSet doubleSet);

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
public abstract Operation notIn(DoubleSet doubleSet);

public abstract Operation notIn(org.eclipse.collections.api.set.primitive.DoubleSet doubleSet);

public abstract Operation greaterThan(double target);

public abstract Operation greaterThanEquals(double target);
Expand Down Expand Up @@ -354,6 +367,11 @@ protected Set<BigDecimal> createBigDecimalSetFromDoubleSet(DoubleSet doubleSet)
return BigDecimalUtil.createBigDecimalSetFromDoubleSet(doubleSet, this.getPrecision(), this.getScale());
}

protected Set<BigDecimal> createBigDecimalSetFromDoubleSet(org.eclipse.collections.api.set.primitive.DoubleSet doubleSet)
{
return BigDecimalUtil.createBigDecimalSetFromDoubleSet(doubleSet, this.getPrecision(), this.getScale());
}

// ByteAttribute operands

public BigDecimalAttribute plus(com.gs.fw.finder.attribute.ByteAttribute attribute)
Expand Down
Expand Up @@ -126,12 +126,28 @@ public Operation nonPrimitiveEq(Object other)

public abstract Operation notEq(boolean other);

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public abstract Operation in(BooleanSet booleanSet);

@Override
public abstract Operation in(org.eclipse.collections.api.set.primitive.BooleanSet booleanSet);

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public abstract Operation notIn(BooleanSet booleanSet);

@Override
public abstract Operation notIn(org.eclipse.collections.api.set.primitive.BooleanSet booleanSet);

// join operation:
/**
* @deprecated use joinEq or filterEq instead
Expand Down
Expand Up @@ -107,12 +107,28 @@ public Operation nonPrimitiveEq(Object other)

public abstract Operation notEq(byte other);

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public abstract Operation in(ByteSet byteSet);

@Override
public abstract Operation in(org.eclipse.collections.api.set.primitive.ByteSet byteSet);

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public abstract Operation notIn(ByteSet byteSet);

@Override
public abstract Operation notIn(org.eclipse.collections.api.set.primitive.ByteSet byteSet);

public abstract Operation greaterThan(byte target);

public abstract Operation greaterThanEquals(byte target);
Expand Down
Expand Up @@ -265,18 +265,40 @@ public Operation notEq(double other)
return notEq(createBigDecimalFromDouble(other));
}

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public Operation in(DoubleSet doubleSet)
{
return this.in(createBigDecimalSetFromDoubleSet(doubleSet));
}

@Override
public Operation in(org.eclipse.collections.api.set.primitive.DoubleSet doubleSet)
{
return this.in(createBigDecimalSetFromDoubleSet(doubleSet));
}

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public Operation notIn(DoubleSet doubleSet)
{
return this.notIn(createBigDecimalSetFromDoubleSet(doubleSet));
}

@Override
public Operation notIn(org.eclipse.collections.api.set.primitive.DoubleSet doubleSet)
{
return this.notIn(createBigDecimalSetFromDoubleSet(doubleSet));
}

public Operation greaterThan(double target)
{
return greaterThan(createBigDecimalFromDouble(target));
Expand Down
Expand Up @@ -224,6 +224,11 @@ public Operation notEq(double other)
return new DoubleNotEqOperation(this, other);
}

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public Operation in(DoubleSet doubleSet)
{
Expand All @@ -244,6 +249,31 @@ public Operation in(DoubleSet doubleSet)
return op;
}

@Override
public Operation in(org.eclipse.collections.api.set.primitive.DoubleSet doubleSet)
{
Operation op;
switch (doubleSet.size())
{
case 0:
op = new None(this);
break;
case 1:
op = this.eq(doubleSet.doubleIterator().next());
break;
default:
op = new DoubleInOperation(this, doubleSet);
break;
}

return op;
}

/**
* @deprecated GS Collections variant of public APIs will be decommissioned in Mar 2018.
* Use Eclipse Collections variant of the same API instead.
**/
@Deprecated
@Override
public Operation notIn(DoubleSet doubleSet)
{
Expand All @@ -264,6 +294,26 @@ public Operation notIn(DoubleSet doubleSet)
return op;
}

@Override
public Operation notIn(org.eclipse.collections.api.set.primitive.DoubleSet doubleSet)
{
Operation op;
switch (doubleSet.size())
{
case 0:
op = new All(this);
break;
case 1:
op = this.notEq(doubleSet.doubleIterator().next());
break;
default:
op = new DoubleNotInOperation(this, doubleSet);
break;
}

return op;
}

public Operation greaterThanEquals(double parameter)
{
return new DoubleGreaterThanEqualsOperation(this, parameter);
Expand Down

0 comments on commit 44456e0

Please sign in to comment.