id
stringlengths
7
14
text
stringlengths
1
106k
309964_18
@Override public int compareTo(Date o) { return super.compareTo(new CCNTime(o)); }
309964_19
public static CCNTime now() { return new CCNTime(); }
309964_20
}
309964_21
public boolean matches(ContentObject test) { return matches(test, (null != test.signedInfo()) ? test.signedInfo().getPublisherKeyID() : null); }
309964_22
public void add(byte omissions[][] ) { if (omissions == null || omissions.length == 0) return; Arrays.sort(omissions, new ByteArrayCompare()); /* * i is an outer loop on the omissions list * j is an inner loop on the ExcludeEntries */ int i = 0, j = 0; byte [] omission; Element ee; Filler lastFiller = nu...
309964_23
public void add(byte omissions[][] ) { if (omissions == null || omissions.length == 0) return; Arrays.sort(omissions, new ByteArrayCompare()); /* * i is an outer loop on the omissions list * j is an inner loop on the ExcludeEntries */ int i = 0, j = 0; byte [] omission; Element ee; Filler lastFiller = nu...
309964_24
public void add(byte omissions[][] ) { if (omissions == null || omissions.length == 0) return; Arrays.sort(omissions, new ByteArrayCompare()); /* * i is an outer loop on the omissions list * j is an inner loop on the ExcludeEntries */ int i = 0, j = 0; byte [] omission; Element ee; Filler lastFiller = nu...
309964_25
public void add(byte omissions[][] ) { if (omissions == null || omissions.length == 0) return; Arrays.sort(omissions, new ByteArrayCompare()); /* * i is an outer loop on the omissions list * j is an inner loop on the ExcludeEntries */ int i = 0, j = 0; byte [] omission; Element ee; Filler lastFiller = nu...
309964_26
public boolean match(byte [] component) { Filler lastFiller = null; synchronized (_values) { for (Element ee : _values) { if (ee instanceof ExcludeComponent) { ExcludeComponent ec = (ExcludeComponent) ee; int res = ec.compareTo(component); if (res == 0) { // we exactly matched a component in the...
309964_27
public static Exclude uptoFactory(byte [] component) { if ( component == null) return null; Exclude ef = new Exclude(); synchronized (ef._values) { ef._values.add(new ExcludeAny()); ef._values.add(new ExcludeComponent(component)); } return ef; }
309964_28
public static Exclude factory(byte omissions [][] ) { if (omissions == null || omissions.length == 0) return null; return new Exclude(omissions); }
309964_29
public void add(byte omissions[][] ) { if (omissions == null || omissions.length == 0) return; Arrays.sort(omissions, new ByteArrayCompare()); /* * i is an outer loop on the omissions list * j is an inner loop on the ExcludeEntries */ int i = 0, j = 0; byte [] omission; Element ee; Filler lastFiller = nu...
309964_30
public boolean empty() { synchronized (_values) { return _values.isEmpty(); } }
309964_31
public int size() { synchronized (_values) { return _values.size(); } }
309964_32
public Object put(String key, Object value) { KeyValuePair kvp = _set.get(key); if (kvp != null) { throw new InvalidParameterException("Duplicate keys not allowed"); } kvp = new KeyValuePair(key, value); _set.put(key, kvp); return value; }
309964_33
@Override public boolean validate() { return (null != contents()); }
309964_34
@Override public boolean validate() { return (null != contents()); }
309964_35
public LinkedList<Link> contents() { return _contents; }
309964_36
}
309964_37
public void add(Link content) { _contents.add(content); }
309964_38
public void add(Link content) { _contents.add(content); }
309964_39
@Override public int hashCode() { return _version.hashCode(); }
309964_40
public VersionNumber() { _version = CCNTime.now(); _versionComponent = VersioningProfile.timeToVersionComponent(_version); _binaryTime = _version.toBinaryTimeAsLong(); }
309964_41
public VersionNumber addAndReturn(long count) { long binaryTime = _version.toBinaryTimeAsLong(); binaryTime += count; return new VersionNumber(CCNTime.fromBinaryTimeAsLong(binaryTime)); }
309964_42
public VersionNumber addMillisecondsAndreturn(long msec) { long result = _version.getTime() + msec; return new VersionNumber(result); }
309964_43
public int compareTo(VersionNumber other) throws ClassCastException { if( null == other ) throw new ClassCastException("Null value"); if( isLessThanUnsigned(_binaryTime, other._binaryTime) ) return -1; if( isLessThanUnsigned(other._binaryTime, _binaryTime) ) return +1; return 0; }
309964_44
public static VersionNumber getMaximumVersion() { return maxVersionNumber; }
309964_45
public static VersionNumber getMinimumVersion() { return minVersionNumber; }
309964_46
public synchronized InterestData splitLeft(int count) { // create a pristine object InterestData left = new InterestData(_name, _startTime, _stopTime); if( count > 0 ) transferLeft(left, count); return left; }
309964_47
public static ContentName addVersion(ContentName name, long version) { // Need a minimum-bytes big-endian representation of version. byte [] vcomp = null; if (0 == version) { vcomp = FIRST_VERSION_MARKER; } else { vcomp = DataUtils.unsignedLongToByteArray(version, VERSION_MARKER); } return new ContentName(nam...
309964_48
public static ContentName addVersion(ContentName name, long version) { // Need a minimum-bytes big-endian representation of version. byte [] vcomp = null; if (0 == version) { vcomp = FIRST_VERSION_MARKER; } else { vcomp = DataUtils.unsignedLongToByteArray(version, VERSION_MARKER); } return new ContentName(nam...
309964_49
public static int findLastVersionComponent(ContentName name) { int i = name.count(); for (;i >= 0; i--) if (isVersionComponent(name.component(i))) return i; return -1; }
309964_50
public static boolean hasTerminalVersion(ContentName name) { if ((name.count() > 0) && ((isVersionComponent(name.lastComponent()) || ((name.count() > 1) && SegmentationProfile.isSegment(name) && isVersionComponent(name.component(name.count()-2)))))) { return true; } return false; }
309964_51
public static Tuple<ContentName, byte[]> cutTerminalVersion(ContentName name) { if (name.count() > 0) { if (isVersionComponent(name.lastComponent())) { return new Tuple<ContentName, byte []>(name.parent(), name.lastComponent()); } else if ((name.count() > 2) && SegmentationProfile.isSegment(name) && isVersionCo...
309964_52
public static boolean isVersionOf(ContentName version, ContentName parent) { ple<ContentName, byte []>versionParts = cutTerminalVersion(version); (!parent.equals(versionParts.first())) { eturn false; // not versions of the same thing (null == versionParts.second()) eturn false; // version isn't a version turn true; }
309964_53
public static CCNTime getLastVersionAsTimestamp(ContentName name) throws VersionMissingException { long time = getLastVersionAsLong(name); return CCNTime.fromBinaryTimeAsLong(time); }
309964_54
public static long getLastVersionAsLong(ContentName name) throws VersionMissingException { int i = findLastVersionComponent(name); if (i == -1) throw new VersionMissingException(); return getVersionComponentAsLong(name.component(i)); }
309964_55
public static long getLastVersionAsLong(ContentName name) throws VersionMissingException { int i = findLastVersionComponent(name); if (i == -1) throw new VersionMissingException(); return getVersionComponentAsLong(name.component(i)); }
309964_56
public static long getLastVersionAsLong(ContentName name) throws VersionMissingException { int i = findLastVersionComponent(name); if (i == -1) throw new VersionMissingException(); return getVersionComponentAsLong(name.component(i)); }
309964_57
public LinkedList<Link> update(ArrayList<ACLOperation> ACLUpdates){ final int LEVEL_NONE = 0; final int LEVEL_READ = 1; final int LEVEL_WRITE = 2; final int LEVEL_MANAGE = 3; //for principals that are affected, //tm records the previous privileges of those principals TreeMap<Link, Integer> tm = new TreeMap<...
309964_58
public NodeKey computeDescendantNodeKey(ContentName descendantNodeName, String keyLabel) throws InvalidKeyException, ContentEncodingException { if (nodeName().equals(descendantNodeName)) { if (Log.isLoggable(Log.FAC_ACCESSCONTROL, Level.INFO)) { Log.info(Log.FAC_ACCESSCONTROL,"Asked to compute ourselves as our...
309964_59
public boolean isDerivedNodeKey() { return (!nodeName().isPrefixOf(storedNodeKeyName())); }
309964_60
public void add(Interest interest, V value) { if (null == interest) { throw new NullPointerException("InterestTable may not contain null Interest"); } if (null == interest.name()) { throw new NullPointerException("InterestTable may not contain Interest with null name"); } if (Log.isLoggable(Log.FAC_ENCODING, L...
309964_61
public void setCapacity(int capacity) { synchronized (_contents) { _capacity = capacity; _contentNamesLRU = new LinkedList<ContentName>(); } }
309964_62
public final static long byteArrayToUnsignedLong(final byte [] src) { long value = 0; for(int i = 0; i < src.length; i++) { value = value << 8; // Java will assume the byte is signed, so extend it and trim it. int b = (src[i]) & 0xFF; value |= b; } return value; }
309964_63
public final static byte [] unsignedLongToByteArray(final long value) { if( 0 == value ) return _byte0; if( 0 <= value && value <= 0x00FF ) { byte [] bb = new byte[1]; bb[0] = (byte) (value & 0x00FF); return bb; } byte [] out = null; int offset = -1; for(int i = 7; i >=0; --i) { byte b = (byte) ((value ...
309964_64
public final static byte [] unsignedLongToByteArray(final long value) { if( 0 == value ) return _byte0; if( 0 <= value && value <= 0x00FF ) { byte [] bb = new byte[1]; bb[0] = (byte) (value & 0x00FF); return bb; } byte [] out = null; int offset = -1; for(int i = 7; i >=0; --i) { byte b = (byte) ((value ...
3102907_0
protected String createMSCHAPV2Response(String username, byte[] password, byte ident, byte[] ntResponse, byte[] peerChallenge, byte[] authenticator) { byte[] authResponse = Authenticator.GenerateAuthenticatorResponse( password, ntResponse, peerChallenge, authenticator, username....
3110085_0
@Compensatable public void transferMoney(String fromAccount, String toAccount, Double amount) { accountManager.debitAccount(fromAccount, amount); accountManager.creditAccount(toAccount, amount); }
3110085_1
@Compensatable public void transferMoney(String fromAccount, String toAccount, Double amount) { accountManager.debitAccount(fromAccount, amount); accountManager.creditAccount(toAccount, amount); }
3110085_2
@GET public String getMessage() throws JMSException { XAConnection connection = xaConnectionFactory.createXAConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = session.createConsumer(queue); connection.start(); TextMessage message = (...
3110085_3
@GET public String getMessage() throws JMSException { XAConnection connection = xaConnectionFactory.createXAConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = session.createConsumer(queue); connection.start(); TextMessage message = (...
3110085_4
public int getNextId() throws SQLException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.getNextId()"); } int id = 1; final Connection connection = getConnection(); final PreparedStatement statement = connection.prepareStatement("SELECT id FROM customer ORDER BY id DESC LIMIT 1;"); ...
3110085_5
public List<Customer> getAll() throws SQLException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.getAll()"); } final Connection connection = getConnection(); final PreparedStatement statement = connection.prepareStatement("SELECT * FROM customer;"); final ResultSet resultSet = stateme...
3110085_6
public void insert(final Customer customer) throws SQLException, DuplicateException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.insert(customer=" + customer + ")"); } if (isDuplicate(customer)) { throw new DuplicateException("Customers with duplicate names and/or IDs are not allowed...
3110085_7
public void insert(final Customer customer) throws SQLException, DuplicateException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.insert(customer=" + customer + ")"); } if (isDuplicate(customer)) { throw new DuplicateException("Customers with duplicate names and/or IDs are not allowed...
3110085_8
public void update(final Customer customer) throws SQLException, DuplicateException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.update(customer=" + customer + ")"); } final Customer currentCustomer = get(customer.getId()); if (isDuplicateName(customer) && !currentCustomer.equals(custome...
3110085_9
public void delete(final Customer customer) throws SQLException { if (LOG.isTraceEnabled()) { LOG.trace("CustomerDAO.delete(customer=" + customer + ")"); } final Connection connection = getConnection(); final PreparedStatement statement = connection.prepareStatement("DELETE FROM customer WHERE i...
3113319_0
@Override public BigDecimal getPrice(Carrier carrier, Map<Purchasable, Long> items) { BigDecimal price = carrier.getPerShipping() != null ? carrier.getPerShipping() : BigDecimal.ZERO; Long numberOfItems = 0l; for (Long number : items.values()) { numberOfItems += number; } if (numberOfItems =...
3113319_1
@Override public BigDecimal getPrice(Carrier carrier, Map<Purchasable, Long> items) { BigDecimal price = carrier.getPerShipping() != null ? carrier.getPerShipping() : BigDecimal.ZERO; Long numberOfItems = 0l; for (Long number : items.values()) { numberOfItems += number; } if (numberOfItems =...
3113319_2
public String getAmountCompact() { return amountCompact; }
3113319_3
public String getAmountCompact() { return amountCompact; }
3113319_4
public List<Product> findAllOnShelf(Integer number, Integer offset) { if (number == 0) { return FluentIterable.from(all()).filter(ON_SHELF).skip(offset).toList(); } return FluentIterable.from(all()).filter(ON_SHELF).skip(offset).limit(number) .toList(); }
3113319_5
public void updateStock(UUID productId, Integer stockOffset) throws EntityDoesNotExistException { Product product = this.findById(productId); product.setStock(product.getStock() + stockOffset); }
3113319_6
public List<Product> findOrphanProducts() { return FluentIterable.from(all()).filter(new Predicate<Product>() { public boolean apply(@Nullable Product input) { return input.getCollections().isLoaded() && input.getCollections().get().isEmpty(); } }).toList(); }
3113319_7
public List<Product> findForCollection(Collection collection, Integer number, Integer offset) { if (number == 0) { return FluentIterable.from(findAllForCollection(collection)).skip(offset).toList(); } return FluentIterable.from(findAllForCollection(collection)).skip(offset).limit(number).toList(); }
3113319_8
public List<Product> findAllWithTitleLike(String title, Integer number, Integer offset) { if (number == 0) { return FluentIterable.from(all()).filter(withTitleLike(title)).skip(offset).toList(); } return FluentIterable.from(all()).filter(withTitleLike(title)).skip(offset).limit(number) ....
3113319_9
public List<EntityAndCount<Collection>> findAllWithProductCount() { return FluentIterable.from(allPositioned()).transform(entityAndCount).toList(); }
3114475_0
public Message buffer(final Buffer byteBuf) { if (!presetContentTypes) { contentType(Content.BYTE_BUFFER); } if (bufferList == null) { bufferList = new ArrayList<Buffer>(1); } bufferList.add(byteBuf); return this; }
3114475_1
public Message buffer(final Buffer byteBuf) { if (!presetContentTypes) { contentType(Content.BYTE_BUFFER); } if (bufferList == null) { bufferList = new ArrayList<Buffer>(1); } bufferList.add(byteBuf); return this; }
3114475_2
public Message setDataMap(final DataMap dataMap) { if (!presetContentTypes) { contentType(Content.MAP_KEY640_DATA); } if (dataMapList == null) { dataMapList = new ArrayList<DataMap>(1); } this.dataMapList.add(dataMap); return this; }
3114475_3
public Message buffer(final Buffer byteBuf) { if (!presetContentTypes) { contentType(Content.BYTE_BUFFER); } if (bufferList == null) { bufferList = new ArrayList<Buffer>(1); } bufferList.add(byteBuf); return this; }
3114475_4
public PeerAddress sender() { return sender; }
3114475_5
public PeerAddress sender() { return sender; }
3114475_6
public double estimatedNumberOfNodes() { final List<Map<Number160, PeerStatistic>> map = peerMap.peerMapVerified(); // assume we are full double gap = 0D; int gapCount = 0; for (int i = 0; i < Number160.BITS; i++) { Map<Number160, PeerStatistic> peers = map.get(i); final int numPeers = peers.size(); if (numP...
3114475_7
public Data release() { synchronized (buffer.lockObject()) { released = true; buffer.release(); } return this; }
3114475_8
public PublicKey publicKey() { return publicKey; }
3114475_9
public static <K> Collection<K> difference(Collection<K> collection1, Collection<K> result, Collection<K> collection2) { for (Iterator<K> iterator = collection1.iterator(); iterator.hasNext();) { K item = iterator.next(); if (!collection2.contains(item)) { result.add(item); ...
3116751_0
protected String buildFullMessage(String message, Object... args) { StringBuilder stringBuilder = new StringBuilder(message.length()); int lastIndex = 0; int argIndex = 0; while (true) { int argPos = message.indexOf(ARGS_PATTERN, lastIndex); if (argPos == -1) { break; } stringBuilder.append(message.subst...
3116751_1
protected String buildFullMessage(String message, Object... args) { StringBuilder stringBuilder = new StringBuilder(message.length()); int lastIndex = 0; int argIndex = 0; while (true) { int argPos = message.indexOf(ARGS_PATTERN, lastIndex); if (argPos == -1) { break; } stringBuilder.append(message.subst...
3116751_2
protected String buildFullMessage(String message, Object... args) { StringBuilder stringBuilder = new StringBuilder(message.length()); int lastIndex = 0; int argIndex = 0; while (true) { int argPos = message.indexOf(ARGS_PATTERN, lastIndex); if (argPos == -1) { break; } stringBuilder.append(message.subst...
3116751_3
protected String buildFullMessage(String message, Object... args) { StringBuilder stringBuilder = new StringBuilder(message.length()); int lastIndex = 0; int argIndex = 0; while (true) { int argPos = message.indexOf(ARGS_PATTERN, lastIndex); if (argPos == -1) { break; } stringBuilder.append(message.subst...
3116751_4
public boolean isLoggable(Level level) { return level.isGreaterOrEquals(loggerContext.getCurrentLevel()); }
3116751_5
File findManifestInKnownPathsStartingFromGenFolder(String sourcesGenerationFolder) { Iterable<AndroidManifestFinderStrategy> strategies = Arrays.asList(new GradleAndroidManifestFinderStrategy(environment, sourcesGenerationFolder), new LegacyGradleAndroidManifestFinderStrategy(environment, sourcesGenerationFolder), ...
3116751_6
public OneParamValidator anyOfTypes(String... types) { return param(new AnyOfTypesParameterRequirement(types)); }
3116751_7
public OneParamValidator extendsType(String qualifiedName) { return param(new ExtendsTypeParameterRequirement(qualifiedName)); }
3116751_8
public OneParamValidator primitiveOrWrapper(TypeKind primitive) { return param(new PrimitiveOrWrapperParameterRequirement(primitive)); }
3116751_9
public OneParamValidator annotatedWith(Class<? extends Annotation> annotationClass) { return param(new AnnotatedWithParameterRequirement(annotationClass)); }
3119164_0
public static IntFunction identityIntFunction() { return identityIntFunction; }
3119164_1
public static LongFunction identityLongFunction() { return identityLongFunction; }
3119164_2
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3119164_3
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3119164_4
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3119164_5
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3119164_6
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3119164_7
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3119164_8
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3119164_9
public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[G...
3125904_0
public boolean readMessages() throws IOException { readMoreData(buffer); if (buffer.position() < MIN_FIX_MSG_SIZE) return false; // search back for the end of the message int end = buffer.position(), pos = end; if (buffer.get(--pos) != END_OF_FIX_MESSAGE) { do { if (pos <...
3125904_1
@SuppressWarnings("unchecked") public <Model> void inject(@NotNull Model model) { try { for (Class type = model.getClass(); type != null && type != Object.class && type != Enum.class; type = type.getSuperclass()) { for (Field field : type.getDeclaredFields()) { injectField(model,...