Skip to content

Commit

Permalink
Some minor post processing to #177
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Aug 23, 2024
1 parent 47bf7aa commit 9ca4c7a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import javax.xml.xpath.XPathExpression;

import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.collection.impl.ICommonsMap;
import com.helger.commons.collection.impl.ICommonsSet;
import com.helger.commons.collection.impl.ICommonsOrderedMap;
import com.helger.commons.collection.impl.ICommonsOrderedSet;
import com.helger.commons.lang.ICloneable;

/**
Expand All @@ -39,15 +39,15 @@ public interface IPSXPathVariables extends ICloneable <PSXPathVariables>, Serial
*/
@Nonnull
@ReturnsMutableCopy
ICommonsMap <String, XPathExpression> getAll ();
ICommonsOrderedMap <String, XPathExpression> getAll ();

/**
* @return All contained variable names. Never <code>null</code>.
* @since v8
*/
@Nonnull
@ReturnsMutableCopy
ICommonsSet <String> getAllNames ();
ICommonsOrderedSet <String> getAllNames ();

/**
* @param sName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import com.helger.commons.annotation.Nonempty;
import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.collection.impl.CommonsLinkedHashMap;
import com.helger.commons.collection.impl.ICommonsMap;
import com.helger.commons.collection.impl.ICommonsSet;
import com.helger.commons.collection.impl.ICommonsOrderedMap;
import com.helger.commons.collection.impl.ICommonsOrderedSet;
import com.helger.commons.state.EChange;
import com.helger.commons.string.StringHelper;
import com.helger.commons.string.ToStringGenerator;
Expand All @@ -43,12 +43,12 @@ public class PSXPathVariables implements IPSXPathVariables
{
@Nonnull
@ReturnsMutableCopy
private static ICommonsMap <String, XPathExpression> _createMap ()
private static ICommonsOrderedMap <String, XPathExpression> _createMap ()
{
return new CommonsLinkedHashMap <> ();
}

private final ICommonsMap <String, XPathExpression> m_aMap;
private final ICommonsOrderedMap <String, XPathExpression> m_aMap;

public PSXPathVariables ()
{
Expand Down Expand Up @@ -137,14 +137,14 @@ public EChange removeAll (@Nullable final Iterable <String> aVars)

@Nonnull
@ReturnsMutableCopy
public ICommonsMap <String, XPathExpression> getAll ()
public ICommonsOrderedMap <String, XPathExpression> getAll ()
{
return m_aMap.getClone ();
}

@Nonnull
@ReturnsMutableCopy
public ICommonsSet <String> getAllNames ()
public ICommonsOrderedSet <String> getAllNames ()
{
return m_aMap.copyOfKeySet ();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
import com.helger.schematron.svrl.SVRLMarshaller;
import com.helger.schematron.svrl.jaxb.SchematronOutputType;

/**
* Test for GitHub issue 177
*
* @author Bertrand Lorentz
*/
public final class Issue177Test
{
private static final Logger LOGGER = LoggerFactory.getLogger (Issue177Test.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@
<let name="var-plus-one" value="$var + 1"/>

<rule context="/a">
<assert role="ERROR" test="$var-plus-one = 2">error message</assert>
<assert role="ERROR" test="$var-plus-one = 2">error message 1</assert>
</rule>
</pattern>
<pattern>
<let name="var-one" value="1"/>
<let name="var" value="$var-one + 1"/>

<rule context="/a">
<assert role="ERROR" test="$var = 2">error message 2</assert>
</rule>
</pattern>
<pattern>
<let name="var" value="1"/>
<let name="var-x" value="2"/>
<let name="var-x-y" value="$var + $var-x +1"/>

<rule context="/a">
<assert role="ERROR" test="$var-x-y = 4">error message 3</assert>
</rule>
</pattern>
</schema>

0 comments on commit 9ca4c7a

Please sign in to comment.