id
stringlengths
7
14
text
stringlengths
1
106k
1206855_6
@Override public int compareTo(TreeType o) { if (this.equals(o)) return 0; int typeResult = type.getName().compareTo(o.type.getName()); if (typeResult != 0) return typeResult; int sizeDiff = children.size() - o.children.size(); if (sizeDiff != 0) return sizeDiff > 0 ? 1 : -1; for (int i = 0, s = children.si...
1206855_7
public static IFilter compact(ITreeFilter filter) { return new Filter(FilterType.COMPACT,filter); }
1206855_8
public static IFilter compact(ITreeFilter filter) { return new Filter(FilterType.COMPACT,filter); }
1206855_9
public static IFilter strip(ITreeFilter filter) { return new Filter(FilterType.STRIP,filter); }
1216286_0
@Override public void read(InputStream in, ReadStatementListener listener) throws IOException, SemanticIOException { throw new NotYetImplementedException(); }
1216286_1
public void execute(String script) throws QueryScriptException { try { Context cx = Context.enter(); Scriptable scope = cx.initStandardObjects(); scope.put(ARAS_SCRIPT_ENGINE_CONTEXT, scope, arasCtx); loadRhinoBinding(scope, cx); cx.evaluateString(scope, script, "queryscript"...
1216286_2
public void execute(String script) throws QueryScriptException { try { Context cx = Context.enter(); Scriptable scope = cx.initStandardObjects(); scope.put(ARAS_SCRIPT_ENGINE_CONTEXT, scope, arasCtx); loadRhinoBinding(scope, cx); cx.evaluateString(scope, script, "queryscript"...
1216286_3
@Override public Set<Statement> getAssociations() { final Set<Statement> directAssocs = super.getAssociations(); final Set<ResourceNode> inheritors = getInheritors(directAssocs); if (inheritors.isEmpty()) { return directAssocs; } final Set<Statement> result = new HashSet<Statement>(); //...
1216286_4
@Override public Set<Statement> getAssociations() { final Set<Statement> directAssocs = super.getAssociations(); final Set<ResourceNode> inheritors = getInheritors(directAssocs); if (inheritors.isEmpty()) { return directAssocs; } final Set<Statement> result = new HashSet<Statement>(); //...
1216286_5
@SuppressWarnings("unchecked") public static <T extends ResourceNode> List<T> sortResources(Collection<T> nodes) { if (nodes.size() < 2) { return new ArrayList<T>(nodes); } final ResourceNode initial = nodes.iterator().next(); ResourceNode predecessor = getPredecessor(initial); ResourceNode successor = getSucces...
1216286_6
@SuppressWarnings("unchecked") public static <T extends ResourceNode> List<T> sortResources(Collection<T> nodes) { if (nodes.size() < 2) { return new ArrayList<T>(nodes); } final ResourceNode initial = nodes.iterator().next(); ResourceNode predecessor = getPredecessor(initial); ResourceNode successor = getSucces...
1216286_7
@Override protected QueryExpression getRoot() { return super.getRoot(); }
121672_10
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_11
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_12
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_13
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_14
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_15
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_16
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_17
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_18
@Override blic String apply( Visibility visibility, Object value ) { if( value == null ) return null; URI uri; if( value instanceof URI ) { uri = (URI) value; } else { try { uri = URI.create( encode( value.toString() ) ); } catch( IllegalArgumentException exception ) { LOG.warn( "faile...
121672_19
public boolean hasPrefix( String key ) { return ( this.get( key ) != null ); }
121672_20
public String getCommonPrefix() { StringBuffer buffer = new StringBuffer(); if( children.size() != 1 ) return buffer.toString(); buildPrefix( buffer, this ); return buffer.toString(); }
121672_21
@Override blic boolean hasNext() { if( currentException != null ) return true; if( isComplete ) return false; if( hasWaiting ) return true; try { getNext(); } catch( Exception exception ) { if( permittedExceptions.contains( exception.getClass() ) ) { LOG.warn( "Caught permitted exception while r...
121672_22
public Tuple get( int[] pos ) { if( pos == null || pos.length == 0 ) return new Tuple( this ); Tuple results = new Tuple( new ArrayList<>( pos.length ) ); for( int i : pos ) results.elements.add( elements.get( i ) ); // skip modifiable check return results; }
121672_23
public Tuple remove( int[] pos ) { verifyModifiable(); // calculate offsets to apply when removing values from elements int offset[] = new int[ pos.length ]; for( int i = 0; i < pos.length; i++ ) { offset[ i ] = 0; for( int j = 0; j < i; j++ ) { if( pos[ j ] < pos[ i ] ) offset[ i ]++; } } Tup...
121672_24
public Tuple leave( int[] pos ) { verifyModifiable(); Tuple results = remove( pos ); List<Object> temp = results.elements; results.elements = this.elements; this.elements = temp; return results; }
121672_25
public int compareTo( Tuple other ) { if( other == null || other.elements == null ) return 1; if( other.elements.size() != this.elements.size() ) return this.elements.size() - other.elements.size(); for( int i = 0; i < this.elements.size(); i++ ) { Comparable lhs = (Comparable) this.elements.get( i ); Compara...
121672_26
public int compareTo( Tuple other ) { if( other == null || other.elements == null ) return 1; if( other.elements.size() != this.elements.size() ) return this.elements.size() - other.elements.size(); for( int i = 0; i < this.elements.size(); i++ ) { Comparable lhs = (Comparable) this.elements.get( i ); Compara...
121672_27
public int compareTo( Tuple other ) { if( other == null || other.elements == null ) return 1; if( other.elements.size() != this.elements.size() ) return this.elements.size() - other.elements.size(); for( int i = 0; i < this.elements.size(); i++ ) { Comparable lhs = (Comparable) this.elements.get( i ); Compara...
121672_28
public int compareTo( Tuple other ) { if( other == null || other.elements == null ) return 1; if( other.elements.size() != this.elements.size() ) return this.elements.size() - other.elements.size(); for( int i = 0; i < this.elements.size(); i++ ) { Comparable lhs = (Comparable) this.elements.get( i ); Compara...
121672_29
public int compareTo( Tuple other ) { if( other == null || other.elements == null ) return 1; if( other.elements.size() != this.elements.size() ) return this.elements.size() - other.elements.size(); for( int i = 0; i < this.elements.size(); i++ ) { Comparable lhs = (Comparable) this.elements.get( i ); Compara...
121672_30
public void setAll( Tuple tuple ) { verifyModifiable(); if( tuple == null ) return; for( int i = 0; i < tuple.elements.size(); i++ ) internalSet( i, tuple.elements.get( i ) ); }
121672_31
public Fields append( Fields fields ) { return appendInternal( fields, false ); }
121672_32
public Fields appendSelector( Fields fields ) { return appendInternal( fields, true ); }
121672_33
public Fields appendSelector( Fields fields ) { return appendInternal( fields, true ); }
121672_34
public Fields rename( Fields from, Fields to ) { if( this.isSubstitution() || this.isUnknown() ) throw new TupleException( "cannot rename fields in a substitution or unknown Fields instance: " + this.print() ); if( from.size() != to.size() ) throw new TupleException( "from and to fields must be the same size" ); if...
121672_35
public Fields subtract( Fields fields ) { if( fields.isAll() ) return Fields.NONE; if( fields.isNone() ) return this; List<Comparable> list = new LinkedList<Comparable>(); Collections.addAll( list, this.get() ); int[] pos = getPos( fields, -1 ); for( int i : pos ) list.set( i, null ); Util.removeAllNulls( list );...
121672_36
public Fields select( Fields selector ) { if( !isOrdered() ) throw new TupleException( "this fields instance can only be used as a selector" ); if( selector.isAll() ) return this; // supports -1_UNKNOWN_RETURNED // guarantees pos arguments remain selector positions, not absolute positions if( isUnknown() ) return...
121672_37
public Fields selectPos( Fields selector ) { return selectPos( selector, 0 ); }
121672_38
public static Fields resolve( Fields selector, Fields... fields ) { boolean hasUnknowns = false; int size = 0; for( Fields field : fields ) { if( field.isUnknown() ) hasUnknowns = true; if( !field.isDefined() && field.isUnOrdered() ) throw new TupleException( "unable to select from field set: " + field.pr...
121672_39
public Fields select( Fields selector ) { if( !isOrdered() ) throw new TupleException( "this fields instance can only be used as a selector" ); if( selector.isAll() ) return this; // supports -1_UNKNOWN_RETURNED // guarantees pos arguments remain selector positions, not absolute positions if( isUnknown() ) return...
121672_40
public int[] getPos() { if( thisPos != null ) return thisPos; // do not clone if( isAll() || isUnknown() ) thisPos = EMPTY_INT; else thisPos = makeThisPos(); return thisPos; }
121672_41
public int[] getPos() { if( thisPos != null ) return thisPos; // do not clone if( isAll() || isUnknown() ) thisPos = EMPTY_INT; else thisPos = makeThisPos(); return thisPos; }
121672_42
public static Fields join( Fields... fields ) { return join( false, fields ); }
121672_43
public Fields applyType( Comparable fieldName, Type type ) { if( type == null ) throw new IllegalArgumentException( "given type must not be null" ); int pos; try { pos = getPos( asFieldName( fieldName ) ); } catch( FieldsResolverException exception ) { throw new IllegalArgumentException( "given field name w...
121672_44
public static Tuple select( Fields selector, TupleEntry... entries ) { // todo: consider just appending tuples values and just peeking those values Tuple result = null; // does not do field checks if( selector.isAll() ) { for( TupleEntry entry : entries ) { if( result == null ) result = entry.getTuple...
121672_45
@Override blic boolean equals( Object object ) { if( this == object ) return true; if( !( object instanceof TupleEntry ) ) return false; TupleEntry that = (TupleEntry) object; if( fields != null ? !fields.equals( that.fields ) : that.fields != null ) return false; // use comparators if in the this side fields ins...
121672_46
public int getInteger( Comparable fieldName ) { return (Integer) getObject( fieldName, int.class ); }
121672_47
public void set( TupleEntry tupleEntry ) { this.tuple.set( fields, tupleEntry.getFields(), tupleEntry.getTuple(), tupleEntry.coercions ); }
1228775_0
public static PaxWicketInjector getInjector() { String applicationName = Application.get().getApplicationKey(); PaxWicketInjector injector = null; synchronized (instance.injectorMap) { injector = instance.injectorMap.get(applicationName); } if (injector == null) { throw new IllegalSt...
1228775_1
public void onInstantiation(Component component) { toWrap.inject(component, component.getClass()); }
1228775_2
@Override public Class<?> getBeanClass(Element element) { return ApplicationDecorator.class; }
1228775_3
@Override public Class<?> getBeanClass(Element element) { return BundleClassResolverHelperDecorator.class; }
1228775_4
@Override public Class<?> getBeanClass(Element element) { return PageFactoryDecorator.class; }
1228775_5
@Override public Class<?> getBeanClass(Element element) { return BundleInjectionProviderHelperDecorator.class; }
1228775_6
@Override public Class<?> getBeanClass(Element element) { return BundleScanningMountPointProviderDecorator.class; }
1228775_7
@Override public Class<?> getBeanClass(Element element) { return FilterFactoryDecorator.class; }
1229527_0
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_1
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_2
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_3
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_4
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_5
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_6
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_7
public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { // just ignore for the moment and try out if we have valid properties separated by "&" fin...
1229527_8
public Map<String, String> match( final Map<String, String> entries ) { final Map<String, String> matching = new HashMap<String, String>(); if( entries != null && !entries.isEmpty() ) { for( Map.Entry<String, String> entry : entries.entrySet() ) { if( m_pattern.matcher( entry.get...
1229527_9
public Map<String, String> match( final Map<String, String> entries ) { final Map<String, String> matching = new HashMap<String, String>(); if( entries != null && !entries.isEmpty() ) { for( Map.Entry<String, String> entry : entries.entrySet() ) { if( m_pattern.matcher( entry.get...
1231687_1
public boolean isBitSet(int bit) { long bitMask = Long.rotateLeft(1, bit); long result = this.bitMaskValue & bitMask; if (result != 0) { return true; } return false; }
1231687_2
public boolean isBitSet(int bit) { long bitMask = Long.rotateLeft(1, bit); long result = this.bitMaskValue & bitMask; if (result != 0) { return true; } return false; }
123235_10
static String getAlgorithmForOid(String oid) throws NoSuchAlgorithmException { if ("1.2.840.10045.2.1".equals(oid)) { return "EC"; } else if ("1.2.840.113549.1.1.1".equals(oid)) { return "RSA"; } else if ("1.2.840.10040.4.1".equals(oid)) { return "DSA"; } else { throw new NoSuchAlgorithmException("Unknown a...
123235_11
static String getAlgorithmForOid(String oid) throws NoSuchAlgorithmException { if ("1.2.840.10045.2.1".equals(oid)) { return "EC"; } else if ("1.2.840.113549.1.1.1".equals(oid)) { return "RSA"; } else if ("1.2.840.10040.4.1".equals(oid)) { return "DSA"; } else { throw new NoSuchAlgorithmException("Unknown a...
123235_12
public static KeyPair recoverKeyPair(byte[] encoded) throws NoSuchAlgorithmException, InvalidKeySpecException { final String algo = getAlgorithmForOid(getOidFromPkcs8Encoded(encoded)); final KeySpec privKeySpec = new PKCS8EncodedKeySpec(encoded); final KeyFactory kf = KeyFactory.getInstance(algo); final PrivateKe...
123235_13
public static KeyPair recoverKeyPair(byte[] encoded) throws NoSuchAlgorithmException, InvalidKeySpecException { final String algo = getAlgorithmForOid(getOidFromPkcs8Encoded(encoded)); final KeySpec privKeySpec = new PKCS8EncodedKeySpec(encoded); final KeyFactory kf = KeyFactory.getInstance(algo); final PrivateKe...
123235_14
public static KeyPair recoverKeyPair(byte[] encoded) throws NoSuchAlgorithmException, InvalidKeySpecException { final String algo = getAlgorithmForOid(getOidFromPkcs8Encoded(encoded)); final KeySpec privKeySpec = new PKCS8EncodedKeySpec(encoded); final KeyFactory kf = KeyFactory.getInstance(algo); final PrivateKe...
123235_15
static PublicKey recoverPublicKey(KeyFactory kf, PrivateKey priv) throws NoSuchAlgorithmException, InvalidKeySpecException { if (priv instanceof RSAPrivateCrtKey) { RSAPrivateCrtKey rsaPriv = (RSAPrivateCrtKey) priv; return kf.generatePublic(new RSAPublicKeySpec(rsaPriv.getModulus(), rsaPriv .getPublicExpone...
123235_16
static BigInteger getRSAPublicExponentFromPkcs8Encoded(byte[] encoded) throws InvalidKeySpecException { if (encoded == null) { throw new InvalidKeySpecException("encoded key is null"); } try { SimpleDERReader reader = new SimpleDERReader(encoded); reader.resetInput(reader.readSequenceAsByteArray()); if (!rea...
1251091_0
public List<Float> getBinned() { if (last == -1) return null; return new ImmutableList.Builder<Float>().addAll(binned).build(); }
1251538_0
public FSMDescription addState(final String name, final StateType type) throws FSMException { throwIfBuilt(); if (name != null && !states.containsKey(name)) { if (type == StateType.START) { if (startState == null) startState = name; else throw new FSMException("Could not add " + name + " as start stat...
1251538_1
public FSMDescription addTransition(final String name, TransitionCondition condition, final String start, final String end, Action action) throws FSMException { throwIfBuilt(); if (this.transitions.containsKey(name)) throw new FSMException("Could not add transition " + name + ". A transition with the same nam...
1251538_2
@Override public boolean allow(Object event, Object entity, State state) { return !(condition.allow(event, entity, state)); }
1251538_3
@Override public boolean allow(Object event, Object entity, State state) { for (TransitionCondition condition : conditions) { if (!condition.allow(event, entity, state)) return false; } return true; }
1251538_4
@Override public boolean allow(Object event, Object entity, State state) { return (type.isInstance(event)); }
1251538_5
@Override public boolean allow(Object event, Object entity, State state) { for (TransitionCondition condition : conditions) { if (condition.allow(event, entity, state)) return true; } return false; }
1251538_6
@SuppressWarnings("unchecked") @Override public <T extends EnvironmentService> T getEnvironmentService(Class<T> type) throws UnavailableServiceException { // force NullPointerException if type is null type.toString(); for (EnvironmentService s : this.globalEnvironmentServices) { if (type.isInstance(s)) { retu...
1251538_7
@SuppressWarnings("unchecked") @Override public <T extends EnvironmentService> T getEnvironmentService(Class<T> type) throws UnavailableServiceException { // force NullPointerException if type is null type.toString(); for (EnvironmentService s : this.globalEnvironmentServices) { if (type.isInstance(s)) { retu...
1251538_8
@Override public Conversation spawn() { try { return spawnAsInititor(new ConversationSpawnEvent()); } catch (FSMException e) { throw new RuntimeException(e); } }
1251538_9
public Location getAgentLocation(UUID participantID) { return (Location) this.sharedState.get("util.location", participantID); }
1251856_0
public int compare(KoanMethod arg0, KoanMethod arg1) { Class<?> declaringClass0 = arg0.getMethod().getDeclaringClass(); Class<?> declaringClass1 = arg1.getMethod().getDeclaringClass(); if(declaringClass0 != declaringClass1){ Logger.getAnonymousLogger().severe("no idea how to handle comparing the classes: " + decla...
1251856_1
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_2
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_3
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_4
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_5
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_6
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_7
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_8
boolean isIgnored(File file){ boolean ignore = false; while(file != null){ String end = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf(System.getProperty("file.separator")) + 1); for(String pathToIgnore: ignoredPaths){ ignore = end.matches(pathToIgnore); if(ignore){ return true; ...
1251856_9
static ResourceBundle createResourceBundle() { ResourceBundle temp = null; try { temp = new PropertyResourceBundle(new FileInputStream( DirectoryManager.injectFileSystemSeparators( DirectoryManager.getProjectI18nDir(), new StringBuilder("messages_").append( Locale.getDefault().getLanguage()).a...
1263661_0
@Override public String getWriteEnabler() { // TODO: Figure out if the message is somehow important for security. byte[] taggedmsg = { 't', 'h', 'i', 's', 'i', 's', 'h', 'm', 'a', 'c', 'f', 'o', 'r' }; if (this.type == CapabilityType.RW) { byte[] tmp = Cryptoutil.hmac(taggedmsg, this.key); byte[] tmp2 = new b...
1263661_1
@Override public Capability getCapability() { return this.capability; }