id
stringlengths
7
14
text
stringlengths
1
106k
338815_45
public static boolean equals(String p1, String p2) { return myIsCaseSensitive ? p1.equals(p2) : p1.equalsIgnoreCase(p2); }
338815_46
@Override public void applyTo(Entry r) { for (Change c : myChanges) { c.applyTo(r); } }
338815_47
@Override public boolean isFileContentChange() { return myChanges.size() == 1 && myChanges.get(0).isFileContentChange(); }
338815_48
public LocalVcs.Memento load() { return load(STORAGE_FILE, new LocalVcs.Memento(), new Loader<LocalVcs.Memento>() { public LocalVcs.Memento load(Stream s) throws IOException { LocalVcs.Memento m = new LocalVcs.Memento(); m.myRoot = s.readEntry(); m.myEntryCounter = s.readInteger(); m.myCha...
338815_49
public Content storeContent(byte[] bytes) { if (isBroken) return new UnavailableContent(); try { int id = myContentStorage.store(bytes); return new StoredContent(this, id); } catch (BrokenStorageException e) { markAsBroken(e); return new UnavailableContent(); } }
338815_50
public byte[] load(int id) throws BrokenStorageException { byte[] result = findInCache(id); if (result != null) return result; result = mySubject.load(id); cacheContent(result, id); return result; }
338815_51
public byte[] load(int id) throws BrokenStorageException { byte[] result = findInCache(id); if (result != null) return result; result = mySubject.load(id); cacheContent(result, id); return result; }
338815_52
@Override public boolean isAvailable() { try { getBytesUnsafe(); return true; } catch (BrokenStorageException e) { return false; } }
338815_53
@Override public byte[] getBytes() { throw new RuntimeException(); }
338815_54
@Override public byte[] getBytes() { throw new RuntimeException(); }
338815_55
@Override public boolean isAvailable() { return false; }
338815_56
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_57
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_58
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_59
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_60
@Override public DirectoryEntry copy() { DirectoryEntry result = copyEntry(); for (Entry child : myChildren) { result.unsafeAddChild(child.copy()); } return result; }
338815_61
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_62
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_63
@Override public boolean hasUnavailableContent(List<Entry> entriesWithUnavailableContent) { for (Entry e : myChildren) { e.hasUnavailableContent(entriesWithUnavailableContent); } return !entriesWithUnavailableContent.isEmpty(); }
338815_64
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_65
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_66
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_67
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_68
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_69
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_70
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_71
@Override public void addChild(Entry child) { checkDoesNotExist(child, child.getName()); unsafeAddChild(child); }
338815_72
public boolean pathEquals(String path) { return Paths.equals(getPath(), path); }
338815_73
@Override public boolean hasUnavailableContent(List<Entry> entriesWithUnavailableContent) { if (myContent.isAvailable()) return false; entriesWithUnavailableContent.add(this); return true; }
338815_74
@Override public FileEntry copy() { return new FileEntry(myId, myName, myContent, myTimestamp, isReadOnly); }
338815_75
@Override protected void collectCreatedDifferences(List<Difference> result) { result.add(new Difference(true, null, this)); }
338815_76
@Override protected void collectDeletedDifferences(List<Difference> result) { result.add(new Difference(true, this, null)); }
338815_77
public Content createContent(Storage s) { try { if (isTooLong()) return new UnavailableContent(); return s.storeContent(getBytes()); } catch (IOException e) { return new UnavailableContent(); } }
338815_78
public Content createContent(Storage s) { try { if (isTooLong()) return new UnavailableContent(); return s.storeContent(getBytes()); } catch (IOException e) { return new UnavailableContent(); } }
338815_79
public Content createContent(Storage s) { try { if (isTooLong()) return new UnavailableContent(); return s.storeContent(getBytes()); } catch (IOException e) { return new UnavailableContent(); } }
338815_80
public Content createContent(Storage s) { try { if (isTooLong()) return new UnavailableContent(); return s.storeContent(getBytes()); } catch (IOException e) { return new UnavailableContent(); } }
338815_81
public boolean equalsTo(Content c) { try { if (!c.isAvailable()) return false; if (isTooLong()) return false; if (getLength() != c.getBytes().length) return false; return Arrays.equals(getBytes(), c.getBytes()); } catch (IOException e) { return false; } }
338815_82
public boolean equalsTo(Content c) { try { if (!c.isAvailable()) return false; if (isTooLong()) return false; if (getLength() != c.getBytes().length) return false; return Arrays.equals(getBytes(), c.getBytes()); } catch (IOException e) { return false; } }
338815_83
public boolean equalsTo(Content c) { try { if (!c.isAvailable()) return false; if (isTooLong()) return false; if (getLength() != c.getBytes().length) return false; return Arrays.equals(getBytes(), c.getBytes()); } catch (IOException e) { return false; } }
338815_84
public IdPath appendedWith(int id) { // todo use Arrays.copyOf after going to 1.6 int[] newPath = new int[myParts.length + 1]; System.arraycopy(myParts, 0, newPath, 0, myParts.length); newPath[newPath.length - 1] = id; return new IdPath(newPath); }
338815_85
public IdPath appendedWith(int id) { // todo use Arrays.copyOf after going to 1.6 int[] newPath = new int[myParts.length + 1]; System.arraycopy(myParts, 0, newPath, 0, myParts.length); newPath[newPath.length - 1] = id; return new IdPath(newPath); }
338815_86
public int getId() { return myParts[myParts.length - 1]; }
338815_87
public IdPath getParent() { if (myParts.length == 1) return null; int[] newPath = new int[myParts.length - 1]; System.arraycopy(myParts, 0, newPath, 0, newPath.length); return new IdPath(newPath); }
338815_88
public boolean isChildOrParentOf(IdPath p) { return startsWith(p) || p.startsWith(this); }
338815_89
public boolean contains(int id) { for (int part : myParts) { if (part == id) return true; } return false; }
338815_90
public boolean startsWith(IdPath p) { if (myParts.length < p.myParts.length) return false; for (int i = 0; i < p.myParts.length; i++) { if (myParts[i] != p.myParts[i]) return false; } return true; }
338815_91
@Override public boolean equals(Object o) { if (o == null || !o.getClass().equals(getClass())) return false; return Arrays.equals(myParts, ((IdPath)o).myParts); }
338815_92
@Override public String toString() { String result = ""; for (int part : myParts) { result += part + "."; } return result.substring(0, result.length() - 1); }
338815_93
public boolean rootEquals(int id) { return myParts[0] == id; }
338815_94
public IdPath withoutRoot() { int[] newPath = new int[myParts.length - 1]; System.arraycopy(myParts, 1, newPath, 0, newPath.length); return new IdPath(newPath); }
3398614_0
protected String constructStatusAndHeaders(AtmosphereResponse response, int contentLength) { StringBuffer b = new StringBuffer("HTTP/1.1") .append(" ") .append(response.getStatus()) .append(" ") .append(response.getStatusMessage()) .append(CRLF); Map<S...
3398614_1
protected String constructStatusAndHeaders(AtmosphereResponse response, int contentLength) { StringBuffer b = new StringBuffer("HTTP/1.1") .append(" ") .append(response.getStatus()) .append(" ") .append(response.getStatusMessage()) .append(CRLF); Map<S...
3398614_2
protected String constructStatusAndHeaders(AtmosphereResponse response, int contentLength) { StringBuffer b = new StringBuffer("HTTP/1.1") .append(" ") .append(response.getStatus()) .append(" ") .append(response.getStatusMessage()) .append(CRLF); Map<S...
3398614_3
protected String constructStatusAndHeaders(AtmosphereResponse response, int contentLength) { StringBuffer b = new StringBuffer("HTTP/1.1") .append(" ") .append(response.getStatus()) .append(" ") .append(response.getStatusMessage()) .append(CRLF); Map<S...
3407114_0
public static PlatformEnum getCurrentPlatformEnum() { return currentPlatformEnum; }
3407114_1
public static long parseHertz(String hertz) { Matcher matcher = HERTZ_PATTERN.matcher(hertz.trim()); if (matcher.find() && matcher.groupCount() == 3) { // Regexp enforces #(.#) format so no test for NFE required double value = Double.valueOf(matcher.group(1)) * multipliers.getOrDefault(matcher.g...
3407114_2
public static int parseLastInt(String s, int i) { try { String ls = parseLastString(s); if (ls.toLowerCase().startsWith("0x")) { return Integer.decode(ls); } else { return Integer.parseInt(ls); } } catch (NumberFormatException e) { LOG.trace(DEFAUL...
3407114_3
public static String parseLastString(String s) { String[] ss = whitespaces.split(s); if (ss.length < 1) { return s; } else { return ss[ss.length - 1]; } }
3407114_4
public static byte[] hexStringToByteArray(String digits) { int len = digits.length(); // Check if string is valid hex if (!VALID_HEX.matcher(digits).matches() || (len & 0x1) != 0) { LOG.warn("Invalid hexadecimal string: {}", digits); return new byte[0]; } byte[] data = new byte[len /...
3407114_5
public static byte[] asciiStringToByteArray(String text, int length) { return Arrays.copyOf(text.getBytes(StandardCharsets.US_ASCII), length); }
3407114_6
public static byte[] longToByteArray(long value, int valueSize, int length) { long val = value; // Convert the long to 8-byte BE representation byte[] b = new byte[8]; for (int i = 7; i >= 0 && val != 0L; i--) { b[i] = (byte) val; val >>>= 8; } // Then copy the rightmost valueSiz...
3407114_7
public static long byteArrayToLong(byte[] bytes, int size) { if (size > 8) { throw new IllegalArgumentException("Can't convert more than 8 bytes."); } if (size > bytes.length) { throw new IllegalArgumentException("Size can't be larger than array length."); } long total = 0L; for ...
3407114_8
public static long byteArrayToLong(byte[] bytes, int size) { if (size > 8) { throw new IllegalArgumentException("Can't convert more than 8 bytes."); } if (size > bytes.length) { throw new IllegalArgumentException("Size can't be larger than array length."); } long total = 0L; for ...
3407114_9
public static float byteArrayToFloat(byte[] bytes, int size, int fpBits) { return byteArrayToLong(bytes, size) / (float) (1 << fpBits); }
3407162_0
public static int defaultSCOSCPort() { return DEFAULT_SC_OSC_PORT; }
3407162_1
public void close() throws IOException { channel.close(); }
3407162_2
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3407162_3
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3407162_4
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3407162_5
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3407162_6
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3407162_7
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3407162_8
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3407162_9
public void connect() throws IOException { if (getRemoteAddress() == null) { throw new IllegalStateException( "Can not connect a socket without a remote address specified"); } getChannel().connect(getRemoteAddress()); }
3409328_0
@JsonIgnore public String getId() { return id; }
3411081_0
@Override public Codec createCodec(String clusterId) throws SQLException { String type = getProperty(clusterId, Property.KEYSTORE_TYPE); File file = new File(getProperty(clusterId, Property.KEYSTORE_FILE)); String password = getProperty(clusterId, Property.KEYSTORE_PASSWORD); String keyAlias = getProperty(clusterId...
3411081_1
@Override public String encode(String value) throws SQLException { try { Cipher cipher = Cipher.getInstance(this.key.getAlgorithm()); cipher.init(Cipher.ENCRYPT_MODE, this.key); return Base64.getEncoder().encodeToString(cipher.doFinal(value.getBytes())); } catch (GeneralSecurityException e) { throw new ...
3411081_2
@Override public String decode(String value) throws SQLException { try { Cipher cipher = Cipher.getInstance(this.key.getAlgorithm()); cipher.init(Cipher.DECRYPT_MODE, this.key); return new String(cipher.doFinal(Base64.getDecoder().decode(value))); } catch (GeneralSecurityException e) { throw new SQLExce...
3411081_3
@Override public String encode(String value) { return value; }
3411081_4
@Override public String decode(String value) { return value; }
3411081_5
@Override public String getAttributeValue(int index) { return this.replace(super.getAttributeValue(index)); }
3411081_6
@Override public String getAttributeValue(int index) { return this.replace(super.getAttributeValue(index)); }
3411081_7
@Override public String getElementText() throws XMLStreamException { return this.replace(super.getElementText()); }
3411081_8
private String getProperty(String[] keys, String defaultValue) { for (String key: keys) { String value = this.properties.getProperty(key.trim()); if (value != null) return value; } return defaultValue; }
3411081_9
@Override public String getText() { return this.replace(super.getText()); }
3415743_0
public <I> void hear(final TypeLiteral<I> type, final TypeEncounter<I> encounter) { Provider<EventCasterInternal> eventCasterProvider = null; for (final Class<?> interfaceClass : listInterfaces(type.getRawType(), new HashSet<Class<?>>())) { final TypeLiteral<?> interfaceType = type.getSupertype(interfac...
3415743_1
public <I> void hear(final TypeLiteral<I> type, final TypeEncounter<I> encounter) { Provider<EventCasterInternal> eventCasterProvider = null; for (final Class<?> interfaceClass : listInterfaces(type.getRawType(), new HashSet<Class<?>>())) { final TypeLiteral<?> interfaceType = type.getSupertype(interfac...
3415743_2
public <I> void hear(final TypeLiteral<I> type, final TypeEncounter<I> encounter) { Provider<EventCasterInternal> eventCasterProvider = null; for (final Class<?> interfaceClass : listInterfaces(type.getRawType(), new HashSet<Class<?>>())) { final TypeLiteral<?> interfaceType = type.getSupertype(interfac...
3415743_3
@Override public void afterInjection(final Object injectee) { eventCasterProvider.get().registerListener(interfaceType, injectee); }
3423262_0
public void setTripStrategy(EntityMergeStrategy tripStrategy) { _tripStrategy = tripStrategy; }
3423262_1
public static <T> double scoreElementOverlap(Collection<T> a, Collection<T> b) { return scoreElementOverlap(a, b, new HashSet<T>()); }
3423262_2
public static double scoreIntervalOverlap(int[] sourceInterval, int[] targetInterval) { int from = Math.max(sourceInterval[0], targetInterval[0]); int to = Math.min(sourceInterval[1], targetInterval[1]); double overlap = Math.max(to - from, 0); return (overlap / (sourceInterval[1] - sourceInterval[0]) + ove...
3423262_3
public void putMinimal() { putAgencies(1); putStops(0); putRoutes(0); putTrips(0, "", ""); putStopTimes("", ""); }
3423262_4
public void putCalendarDates(String... specs) { List<String> serviceIds = new ArrayList<String>(); List<String> serviceDates = new ArrayList<String>(); List<String> exceptionTypes = new ArrayList<String>(); for (String spec : specs) { int index = spec.indexOf('='); if (index == -1) { throw new Ill...
3423262_5
@Override public int compareTo(LocalizedServiceId o) { int rc = this.id.compareTo(o.id); if (rc == 0) rc = this.timeZone.getID().compareTo(o.getTimeZone().getID()); return rc; }
3423262_6
public Date getAsDate() { return getAsDate(TimeZone.getDefault()); }
3423262_7
public Date getAsDate() { return getAsDate(TimeZone.getDefault()); }
3423262_8
public Date getAsDate() { return getAsDate(TimeZone.getDefault()); }
3423262_9
public Date getAsDate() { return getAsDate(TimeZone.getDefault()); }
3424353_0
public static <K extends Number, V extends Number> double interpolate( SortedMap<K, V> values, K target) { return interpolate(values, target, EOutOfRangeStrategy.INTERPOLATE); }