This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added comparator chain so that we can merge correctly
- Loading branch information
Todd Nine
committed
Jun 17, 2015
1 parent
aa31768
commit 1fe6906
Showing
24 changed files
with
411 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...main/java/org/apache/usergrid/persistence/cassandra/index/DynamicCompositeComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.usergrid.persistence.cassandra.index; | ||
|
||
|
||
import java.nio.ByteBuffer; | ||
import java.util.Comparator; | ||
|
||
import org.apache.cassandra.db.marshal.AbstractType; | ||
import org.apache.cassandra.db.marshal.TypeParser; | ||
|
||
import org.apache.usergrid.persistence.cassandra.ApplicationCF; | ||
|
||
|
||
public abstract class DynamicCompositeComparator implements Comparator<ByteBuffer> { | ||
@SuppressWarnings("rawtypes") | ||
protected final AbstractType dynamicComposite; | ||
|
||
|
||
protected DynamicCompositeComparator( ApplicationCF cf ) { | ||
// should never happen, this will blow up during development if this fails | ||
try { | ||
dynamicComposite = TypeParser.parse( cf.getComparator() ); | ||
} | ||
catch ( Exception e ) { | ||
throw new RuntimeException( e ); | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...va/org/apache/usergrid/persistence/cassandra/index/DynamicCompositeForwardComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.usergrid.persistence.cassandra.index; | ||
|
||
|
||
import java.nio.ByteBuffer; | ||
|
||
import org.apache.usergrid.persistence.cassandra.ApplicationCF; | ||
|
||
|
||
class DynamicCompositeForwardComparator extends DynamicCompositeComparator { | ||
|
||
/** | ||
* @param cf | ||
*/ | ||
protected DynamicCompositeForwardComparator( ApplicationCF cf ) { | ||
super( cf ); | ||
} | ||
|
||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public int compare( ByteBuffer o1, ByteBuffer o2 ) { | ||
return dynamicComposite.compare( o1, o2 ); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...va/org/apache/usergrid/persistence/cassandra/index/DynamicCompositeReverseComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.usergrid.persistence.cassandra.index; | ||
|
||
|
||
import java.nio.ByteBuffer; | ||
|
||
import org.apache.usergrid.persistence.cassandra.ApplicationCF; | ||
|
||
|
||
class DynamicCompositeReverseComparator extends DynamicCompositeComparator { | ||
/** | ||
* @param cf | ||
*/ | ||
protected DynamicCompositeReverseComparator( ApplicationCF cf ) { | ||
super( cf ); | ||
} | ||
|
||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public int compare( ByteBuffer o1, ByteBuffer o2 ) { | ||
return dynamicComposite.compare( o2, o1 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.