Tabnine Logo
org.apache.stanbol.entityhub.servicesapi.util
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.stanbol.entityhub.servicesapi.util

Best Java code snippets using org.apache.stanbol.entityhub.servicesapi.util (Showing top 20 results out of 315)

origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

/**
 * Constructs an iterator that selects only elements of the parsed iterator
 * that are assignable to the parse type
 * @param it the base iterator
 * @param type the type all elements of this Iterator need to be assignable to.
 */
@SuppressWarnings("unchecked")
public TypeSafeIterator(Iterator<?> it,Class<T> type){
  super((Iterator<Object>)it,new AssignableFormAdapter<T>(),type);
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

@Override
public A adapt(A value, Class<A> type) {
  if(filter.isValid(value)){
    return value;
  } else {
    return null;
  }
}

origin: apache/stanbol

@Override
public final boolean hasNext() {
  if(hasNext == null){ // only once even with multiple calls
    next = prepareNext();
    hasNext = next != null;
  }
  return hasNext;
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

public static String value2Regex(String value){
  return '^'+escapeRegex(value)+'$';
}
/**
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

/**
 * Getter for the ID's of the symbols defined as successors of this one.
 * @return The id's of the symbols defined as successors of this one or an
 * empty list if there are no successors are defined.
 */
public final Iterator<String> getSuccessors() {
  return new ToStringIterator(metadata.get(SUCCESSOR));
}
origin: apache/stanbol

/**
 * Creates an instance that iterates over values and returns {@link Text}
 * instances that confirm to the active languages. If no languages are parsed
 * or <code>null</code> is parsed as a language, this Iterator also creates
 * and returns {@link Text} instances for {@link String} values.
 * @param valueFactory the factory used to create text instances for String values
 * @param it the iterator
 * @param languages The active languages or no values to accept all languages
 */
public TextIterator(ValueFactory valueFactory,Iterator<Object> it,String...languages){
  super(it,new TextAdapter(valueFactory, languages),Text.class);
}
private static class TextAdapter implements Adapter<Object,Text>{
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

public FilteringIterator(Iterator<T> iterator,Filter<T> filter,Class<T> type) {
  super(iterator,new FilterAdapter<T>(filter),type);
}

origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

protected A prepareNext(){
  T check;
  A converted;
  while(it.hasNext()){
    check = it.next();
    converted = adapter.adapt(check,type);
    if(converted != null){
      return converted;
    }
  }
  return null;
}
origin: apache/stanbol

public static String value2Regex(String value){
  return '^'+escapeRegex(value)+'$';
}
/**
origin: apache/stanbol

/**
 * Getter for the ID's of the symbols defined as successors of this one.
 * @return The id's of the symbols defined as successors of this one or an
 * empty list if there are no successors are defined.
 */
public final Iterator<String> getSuccessors() {
  return new ToStringIterator(metadata.get(SUCCESSOR));
}
origin: apache/stanbol

/**
 * Constructs an iterator that selects only elements of the parsed iterator
 * that are assignable to the parse type
 * @param it the base iterator
 * @param type the type all elements of this Iterator need to be assignable to.
 */
@SuppressWarnings("unchecked")
public TypeSafeIterator(Iterator<?> it,Class<T> type){
  super((Iterator<Object>)it,new AssignableFormAdapter<T>(),type);
}
origin: apache/stanbol

@Override
public A adapt(A value, Class<A> type) {
  if(filter.isValid(value)){
    return value;
  } else {
    return null;
  }
}

origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

@Override
public final boolean hasNext() {
  if(hasNext == null){ // only once even with multiple calls
    next = prepareNext();
    hasNext = next != null;
  }
  return hasNext;
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

/**
 * Creates an instance that iterates over values and returns {@link Text}
 * instances that confirm to the active languages. If no languages are parsed
 * or <code>null</code> is parsed as a language, this Iterator also creates
 * and returns {@link Text} instances for {@link String} values.
 * @param valueFactory the factory used to create text instances for String values
 * @param it the iterator
 * @param languages The active languages or no values to accept all languages
 */
public TextIterator(ValueFactory valueFactory,Iterator<Object> it,String...languages){
  super(it,new TextAdapter(valueFactory, languages),Text.class);
}
private static class TextAdapter implements Adapter<Object,Text>{
origin: apache/stanbol

public FilteringIterator(Iterator<T> iterator,Filter<T> filter,Class<T> type) {
  super(iterator,new FilterAdapter<T>(filter),type);
}

origin: apache/stanbol

protected A prepareNext(){
  T check;
  A converted;
  while(it.hasNext()){
    check = it.next();
    converted = adapter.adapt(check,type);
    if(converted != null){
      return converted;
    }
  }
  return null;
}
origin: apache/stanbol

/**
 * Creates a regex that matches vales against whole words
 * ('<code>\b{value}\b</code>)
 * @param word the word to match
 * @return the regex to match words
 * @since 0.12.1
 */
public static String word2Regex(String word){
  return escapeRegex(word, new StringBuilder("\\b")).append("\\b").toString();
}

origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

/**
 * Getter for the ID's of the symbols defined as predecessors of this one.
 * @return The id's of the symbols defined as predecessors of this one or an
 * empty list if there are no predecessors are defined.
 */
public final Iterator<String> getPredecessors() {
  return new ToStringIterator(metadata.get(PREDECESSOR));
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.servicesapi

/**
 * Creates a regex that matches vales against whole words
 * ('<code>\b{value}\b</code>)
 * @param word the word to match
 * @return the regex to match words
 * @since 0.12.1
 */
public static String word2Regex(String word){
  return escapeRegex(word, new StringBuilder("\\b")).append("\\b").toString();
}

origin: apache/stanbol

/**
 * Getter for the ID's of the symbols defined as predecessors of this one.
 * @return The id's of the symbols defined as predecessors of this one or an
 * empty list if there are no predecessors are defined.
 */
public final Iterator<String> getPredecessors() {
  return new ToStringIterator(metadata.get(PREDECESSOR));
}
org.apache.stanbol.entityhub.servicesapi.util

Most used classes

  • ModelUtils
    Utilities useful for implementations of the Entityhub Model
  • AdaptingIterator
    Uses the parsed Adapter to convert values of type T to values of type A. If an instance of T can not
  • PatternUtils
  • TypeSafeIterator
    Filters elements of the base Iterator base on the generic type of this one
  • AdaptingIterator$Adapter
    Adapts values of type T to values of type A. null indicated that the adaption is not possible for th
  • FilteringIterator$FilterAdapter,
  • FilteringIterator,
  • TextIterator$TextAdapter,
  • TextIterator,
  • ToStringIterator,
  • TypeSafeIterator$AssignableFormAdapter
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now