Java Code Examples for com.helger.commons.collection.impl.ICommonsOrderedSet#add()

The following examples show how to use com.helger.commons.collection.impl.ICommonsOrderedSet#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLCharHelper.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Nullable
@ReturnsMutableCopy
public static ICommonsOrderedSet <Character> getAllInvalidXMLTextChars (@Nonnull final EXMLSerializeVersion eXMLVersion,
                                                                        @Nullable final char [] aChars,
                                                                        @Nonnegative final int nOfs,
                                                                        @Nonnegative final int nLen)
{
  if (aChars == null || nLen <= 0)
    return null;

  final ICommonsOrderedSet <Character> aRes = new CommonsLinkedHashSet <> ();
  for (int i = 0; i < nLen; ++i)
  {
    final char c = aChars[nOfs + i];
    if (isInvalidXMLTextChar (eXMLVersion, c))
      aRes.add (Character.valueOf (c));
  }
  return aRes;
}
 
Example 2
Source File: XMLCharHelper.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Nullable
@ReturnsMutableCopy
public static ICommonsOrderedSet <Character> getAllInvalidXMLCDATAChars (@Nonnull final EXMLSerializeVersion eXMLVersion,
                                                                         @Nullable final char [] aChars,
                                                                         @Nonnegative final int nOfs,
                                                                         @Nonnegative final int nLen)
{
  if (aChars == null || nLen <= 0)
    return null;

  final ICommonsOrderedSet <Character> aRes = new CommonsLinkedHashSet <> ();
  for (int i = 0; i < nLen; ++i)
  {
    final char c = aChars[nOfs + i];
    if (isInvalidXMLCDATAChar (eXMLVersion, c))
      aRes.add (Character.valueOf (c));
  }
  return aRes;
}
 
Example 3
Source File: XMLCharHelper.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Nullable
@ReturnsMutableCopy
public static ICommonsOrderedSet <Character> getAllInvalidXMLAttributeValueChars (@Nonnull final EXMLSerializeVersion eXMLVersion,
                                                                                  @Nullable final char [] aChars,
                                                                                  @Nonnegative final int nOfs,
                                                                                  @Nonnegative final int nLen)
{
  if (aChars == null || nLen <= 0)
    return null;

  final ICommonsOrderedSet <Character> aRes = new CommonsLinkedHashSet <> ();
  for (int i = 0; i < nLen; ++i)
  {
    final char c = aChars[nOfs + i];
    if (isInvalidXMLAttributeValueChar (eXMLVersion, c))
      aRes.add (Character.valueOf (c));
  }
  return aRes;
}
 
Example 4
Source File: GraphNode.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public ICommonsOrderedSet <IMutableGraphNode> getAllRelatedNodes ()
{
  final ICommonsOrderedSet <IMutableGraphNode> ret = new CommonsLinkedHashSet <> ();
  if (m_aRelations != null)
    for (final IMutableGraphRelation aRelation : m_aRelations.values ())
    {
      ret.add (aRelation.getNode1 ());
      ret.add (aRelation.getNode2 ());
    }
  return ret;
}
 
Example 5
Source File: GraphNode.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public ICommonsOrderedSet <String> getAllRelatedNodeIDs ()
{
  final ICommonsOrderedSet <String> ret = new CommonsLinkedHashSet <> ();
  if (m_aRelations != null)
    for (final IMutableGraphRelation aRelation : m_aRelations.values ())
    {
      ret.add (aRelation.getNode1ID ());
      ret.add (aRelation.getNode2ID ());
    }
  return ret;
}
 
Example 6
Source File: XMLCharHelper.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nullable
@ReturnsMutableCopy
public static ICommonsOrderedSet <Character> getAllInvalidXMLNameChars (@Nonnull final EXMLSerializeVersion eXMLVersion,
                                                                        @Nullable final char [] aChars,
                                                                        @Nonnegative final int nOfs,
                                                                        @Nonnegative final int nLen)
{
  if (aChars == null || nLen <= 0)
    return null;

  final ICommonsOrderedSet <Character> aRes = new CommonsLinkedHashSet <> ();
  int nIndex = 0;
  for (int i = 0; i < nLen; ++i)
  {
    final char c = aChars[nOfs + i];
    if (nIndex == 0)
    {
      if (isInvalidXMLNameStartChar (eXMLVersion, c))
        aRes.add (Character.valueOf (c));
    }
    else
    {
      if (isInvalidXMLNameChar (eXMLVersion, c))
        aRes.add (Character.valueOf (c));
    }
    ++nIndex;
  }
  return aRes;
}
 
Example 7
Source File: ClassHierarchyCache.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
@ReturnsMutableCopy
public ICommonsOrderedSet <Class <?>> getAsSet ()
{
  // Use a linked hash set, to maintain the order
  final ICommonsOrderedSet <Class <?>> ret = new CommonsLinkedHashSet <> (m_aList.size ());
  for (final WeakReference <Class <?>> aRef : m_aList)
  {
    final Class <?> aClass = aRef.get ();
    if (aClass != null)
      ret.add (aClass);
  }
  return ret;
}