public class SplitNameProvider extends Object implements NameProvider
This name provider will take a name, provided by another name provider, split
it into tokens, by the means of a regular expression. After that it will
selected tokens, based on the
fromStart
and
fromEnd
positions and re-assemble the string using the provided
delimiter.
If
fromStart
is positive, tokens before that index will be included.
Otherwise they will be rejected.
If
fromEnd
is positive, tokens after that index will be included.
Otherwise they will be rejected.
Assuming the pattern is
-
and the delimiter is
.
Name | fromStart | fromEnd | Result | |
---|---|---|---|---|
1-2-3-4-5 | 2 | 0 | 1.2 | |
1-2-3-4-5 | 0 | 2 | 4.5 | |
1-2-3-4-5 | -2 | 0 | 3.4 | |
1-2-3-4-5 | 0 | -2 | 1.2.3 |
Constructor and Description |
---|
SplitNameProvider(NameProvider nameProvider,
Pattern pattern,
int fromStart,
int fromEnd,
String delimiter)
Create a new split name provider
|
SplitNameProvider(NameProvider nameProvider,
String pattern,
int fromStart,
int fromEnd,
String delimiter)
Create a new split name provider
Actually calls SplitNameProvider(NameProvider, Pattern, int, int, String) with
Pattern.compile(String) |
public SplitNameProvider(NameProvider nameProvider, Pattern pattern, int fromStart, int fromEnd, String delimiter)
The parameters fromStart and fromEnd actually define how much to take from the start and from the end.
nameProvider
- the provider of the name to splitpattern
- the patternfromStart
- the number of tokens to take from the startfromEnd
- the number of tokens to take from the enddelimiter
- the delimiterpublic SplitNameProvider(NameProvider nameProvider, String pattern, int fromStart, int fromEnd, String delimiter)
SplitNameProvider(NameProvider, Pattern, int, int, String)
with
Pattern.compile(String)
nameProvider
- the provider of the name to splitpattern
- the patternfromStart
- the number of tokens to take from the startfromEnd
- the number of tokens to take from the enddelimiter
- the delimiterpublic String getName(ItemDescriptor descriptor)
getName
in interface NameProvider
Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.