-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from milosimpson/atTranspose4
Ability to Transpose data in Shiftr.
- Loading branch information
Showing
56 changed files
with
2,025 additions
and
204 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
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
41 changes: 41 additions & 0 deletions
41
jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathStep.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,41 @@ | ||
/* | ||
* Copyright 2014 Bazaarvoice, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package com.bazaarvoice.jolt.common; | ||
|
||
import com.bazaarvoice.jolt.common.pathelement.LiteralPathElement; | ||
|
||
/** | ||
* A tuple class that contains the data for one level of a | ||
* tree walk, aka a reference to the input for that level, and | ||
* the LiteralPathElement that was matched at that level. | ||
*/ | ||
public final class PathStep { | ||
private final Object treeRef; | ||
private final LiteralPathElement literalPathElement; | ||
|
||
public PathStep(Object treeRef, LiteralPathElement literalPathElement) { | ||
this.treeRef = treeRef; | ||
this.literalPathElement = literalPathElement; | ||
} | ||
|
||
public Object getTreeRef() { | ||
return treeRef; | ||
} | ||
|
||
public LiteralPathElement getLiteralPathElement() { | ||
return literalPathElement; | ||
} | ||
} |
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
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
68 changes: 68 additions & 0 deletions
68
jolt-core/src/main/java/com/bazaarvoice/jolt/common/pathelement/HashPathElement.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,68 @@ | ||
/* | ||
* Copyright 2013 Bazaarvoice, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package com.bazaarvoice.jolt.common.pathelement; | ||
|
||
import com.bazaarvoice.jolt.common.WalkedPath; | ||
import com.bazaarvoice.jolt.exception.SpecException; | ||
import com.bazaarvoice.jolt.utils.StringTools; | ||
|
||
/** | ||
* For use on the LHS, allows the user to specify an explicit string to write out. | ||
* Aka given a input that is boolean, would want to write something out other than "true" / "false". | ||
*/ | ||
public class HashPathElement extends BasePathElement implements MatchablePathElement { | ||
|
||
private final String keyValue; | ||
|
||
public HashPathElement( String key ) { | ||
super(key); | ||
|
||
if ( StringTools.isBlank( key ) ) { | ||
throw new SpecException( "HashPathElement cannot have empty String as input." ); | ||
} | ||
|
||
if ( ! key.startsWith( "#" ) ) { | ||
throw new SpecException( "LHS # should start with a # : " + key ); | ||
} | ||
|
||
if ( key.length() <= 1 ) { | ||
throw new SpecException( "HashPathElement input is too short : " + key ); | ||
} | ||
|
||
|
||
if ( key.charAt( 1 ) == '(' ) { | ||
if ( key.charAt( key.length() -1 ) == ')' ) { | ||
keyValue = key.substring( 2, key.length() -1 ); | ||
} | ||
else { | ||
throw new SpecException( "HashPathElement, mismatched parens : " + key ); | ||
} | ||
} | ||
else { | ||
keyValue = key.substring( 1 ); | ||
} | ||
} | ||
|
||
@Override | ||
public String getCanonicalForm() { | ||
return "#(" + keyValue + ")"; | ||
} | ||
|
||
@Override | ||
public LiteralPathElement match( String dataKey, WalkedPath walkedPath ) { | ||
return new LiteralPathElement( keyValue ); | ||
} | ||
} |
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.