code
stringlengths
73
34.1k
label
stringclasses
1 value
public RowBuilder int16(String name) { ColumnInt16 column = new ColumnInt16(_columns.size(), name, _offset); _offset += column.length(); _columns.add(column); return this; }
java
public RowBuilder int32(String name) { ColumnInt32 column = new ColumnInt32(_columns.size(), name, _offset); _offset += column.length(); _columns.add(column); return this; }
java
public RowBuilder int64(String name) { ColumnInt64 column = new ColumnInt64(_columns.size(), name, _offset); _offset += column.length(); _columns.add(column); return this; }
java
public RowBuilder floatCol(String name) { ColumnFloat column = new ColumnFloat(_columns.size(), name, _offset); _offset += column.length(); _columns.add(column); return this; }
java
public RowBuilder doubleCol(String name) { ColumnDouble column = new ColumnDouble(_columns.size(), name, _offset); _offset += column.length(); _columns.add(column); return this; }
java
public RowBuilder timestampCol(String name) { Column column = new ColumnTimestamp(_columns.size(), name, _offset); _offset += column.length(); _columns.add(column); return this; }
java
public RowBuilder identityCol(String name) { Column column = new ColumnIdentity(_columns.size(), name, _offset); _offset += column.length(); _columns.add(column); return this; }
java
public int getInt(String name) { Integer value = (Integer) get(name); if (value != null) return value.intValue(); else return 0; }
java
public <T> void publisher(Class<T> api, Result<T> result) { String path = api.getName(); String address = address(path); ServicesAmp manager = ServicesAmp.current(); ServiceRefAmp pubRef = manager.service(address); result.ok(pubRef.as(api)); }
java
public InputStream getResourceAsStream(String name) { Source path; path = getPath(name); if (path != null && path.canRead()) { try { return path.inputStream(); } catch (Exception e) { } } return null; }
java
public static JarPath create(PathImpl backing) { backing = backing.unwrap(); if (backing instanceof JarPath) { return (JarPath) backing; } JarPath path = _jarCache.get(backing); if (path == null) { path = new JarPath(null, "/", "/", backing); _jarCache.put(backing, pat...
java
public void write(LineMap lineMap) throws IOException { _os.println("SMAP"); _os.println(lineMap.getDestFilename()); _os.println(_sourceType); _os.println("*S " + _sourceType); IntMap fileMap = new IntMap(); _os.println("*F"); Iterator<LineMap.Line> iter = lineMap.iterator(); whi...
java
@Override public boolean isIdleAlmostExpired(long delta) { long now = CurrentTime.currentTime(); return (_pool.getLoadBalanceIdleTime() < now - _idleStartTime + delta); }
java
@Override public void free(long idleStartTime) { if (_is == null) { IllegalStateException exn = new IllegalStateException(L.l("{0} unexpected free of closed stream", this)); exn.fillInStackTrace(); log.log(Level.FINE, exn.toString(), exn); return; } long requestStartTime = _req...
java
public void write(byte []buf, int offset, int length, boolean isEnd) throws IOException { int end = offset + length; while (offset < end) { int ch1 = buf[offset++] & 0xff; if (ch1 < 0x80) os.write(ch1); else if ((ch1 & 0xe0) == 0xc0) { if (offset >= end) throw ...
java
public static String getMimeName(String encoding) { if (encoding == null) return null; String value = _mimeName.get(encoding); if (value != null) return value; String upper = normalize(encoding); String lookup = _mimeName.get(upper); value = lookup == null ? upper : lookup; ...
java
public static String getMimeName(Locale locale) { if (locale == null) return "utf-8"; String mimeName = _localeName.get(locale.toString()); if (mimeName == null) mimeName = _localeName.get(locale.getLanguage()); if (mimeName == null) return "utf-8"; else return mimeName; ...
java
public static EncodingWriter getWriteEncoding(String encoding) { if (encoding == null) encoding = "iso-8859-1"; EncodingWriter factory = _writeEncodingFactories.get(encoding); if (factory != null) return factory.create(); factory = _writeEncodingFactories.get(encoding); if (factory...
java
public static String getJavaName(String encoding) { if (encoding == null) return null; String javaName = _javaName.get(encoding); if (javaName != null) return javaName; String upper = normalize(encoding); javaName = _javaName.get(upper); if (javaName == null) { St...
java
public static String getJavaName(Locale locale) { if (locale == null) return null; return getJavaName(getMimeName(locale)); }
java
private static String normalize(String name) { CharBuffer cb = new CharBuffer(); int len = name.length(); for (int i = 0; i < len; i++) { char ch = name.charAt(i); if (Character.isLowerCase(ch)) cb.append(Character.toUpperCase(ch)); else if (ch == '_') cb.append('-'); ...
java
public void fsync(long sequence, K key, Result<Boolean> result) { scheduleFsync(sequence, key, result); flush(); }
java
public void scheduleFsync(long sequence, K key, Result<Boolean> result) { _requestSequence = Math.max(_requestSequence, sequence); if (sequence <= _tailSequence) { result.ok(Boolean.TRUE); } else { _storeFsync.addResult(key, result); } }
java
@AfterBatch public void afterBatch() { long requestSequence = _requestSequence; if (! _isFsync) { return; } _isFsync = false; try { _storeFsync.fsync(); /* if (_tailSequence < requestSequence) { _storeFsync.fsync(); } */ } catch (Thr...
java
public void stream(OutputStream os, HeadersAmp headers, String from, long qId, String address, String methodName, PodRef podCaller, ResultStream<?> result, ...
java
int insert(Row row, byte []sourceBuffer, int sourceOffset, BlobOutputStream []blobs) { int rowHead = _rowHead; int blobTail = _blobTail; int rowLength = row.length(); rowHead -= rowLength; // return false if the block is full if (rowHead <...
java
boolean remove(RowCursor cursor) { int rowHead = _rowHead; int blobTail = _blobTail; rowHead -= cursor.removeLength(); if (rowHead < blobTail) { return false; } byte []buffer = _buffer; // buffer[rowHead] = REMOVE; cursor.getRemove(buffer, rowHead); // cu...
java
int findAndFill(RowCursor cursor) { int ptr = find(cursor); if (ptr >= 0) { cursor.setRow(_buffer, ptr); cursor.setLeafBlock(this, ptr); } return ptr; }
java
int find(RowCursor cursor) { int rowOffset = _rowHead; int sortOffset = _rowSortHead; int rowLength = cursor.length(); int removeLength = cursor.removeLength(); byte []buffer = _buffer; while (rowOffset < sortOffset) { int code = buffer[rowOffset] & CODE_MASK; switch (c...
java
boolean first(RowCursor minCursor, RowCursor resultCursor, boolean isMatch) { int ptr = _rowHead; int rowLength = resultCursor.length(); int removeLength = resultCursor.removeLength(); int sortOffset = _rowSortHead; byte []buffer = _buffer; while (ptr < ...
java
private boolean findFirstSorted(RowCursor minCursor, RowCursor resultCursor, boolean isMatch) { int rowOffset = _rowSortHead; int rowLength = resultCursor.length(); int cmp = resultCursor.compareKey(_keyMinSort, 0); if (cmp < 0 || c...
java
byte[] getFirstKey(TableKelp table) { int keyOffset = table.getKeyOffset(); int keyLength = table.getKeyLength(); int offset = _rowHead + keyOffset; byte []key = new byte[keyLength]; byte []buffer = getBuffer(); System.arraycopy(buffer, offset, key, 0, keyLength); retur...
java
void fillEntryTree(Set<PageLeafEntry> entries, Row row) { int ptr = _rowHead; byte []buffer = _buffer; while (ptr < BLOCK_SIZE) { int code = buffer[ptr] & CODE_MASK; int len = getLength(code, row); if (code == INSERT || code == REMOVE) { PageLeafEntry ...
java
void validateBlock(Row row) { if (! row.getDatabase().isValidate()) { return; } int rowHead = _rowHead; int blobTail = _blobTail; if (rowHead < blobTail) { throw new IllegalStateException(this + " rowHead:" + rowHead ...
java
void fillDeltaEntries(Set<PageLeafEntry> entries, Row row, int tail) { int rowOffset = _rowHead; byte []buffer = _buffer; while (rowOffset < tail) { int code = buffer[rowOffset] & CODE_MASK; int len = getLength(code, row); if (code =...
java
void writeCheckpointFull(OutputStream os, int rowHead) throws IOException { BitsUtil.writeInt16(os, _blobTail); os.write(_buffer, 0, _blobTail); rowHead = Math.max(rowHead, _rowHead); int rowLength = _buffer.length - rowHead; BitsUtil.writeInt16(os, rowLength); os.write(_buf...
java
void readCheckpointFull(InputStream is) throws IOException { _blobTail = BitsUtil.readInt16(is); if (_blobTail < 0 || _buffer.length < _blobTail) { throw new IllegalStateException("Invalid blob tail: " + _blobTail //+ " pos=" + (is.getPosition() - 2) ...
java
@Override public void shutdown(ShutdownModeAmp mode) { QueryMap queryMap = _queryMapRef.get(); if (queryMap != null) { queryMap.close(); } }
java
public void add(int i) { if (_data.length <= _size) expand(_size + 1); _data[_size++] = i; }
java
public void add(IntArray array) { if (_data.length <= array._size) expand(_size + array._size); for (int i = 0; i < array._size; i++) _data[_size++] = array._data[i]; }
java
public void add(int i, int value) { expand(_size + 1); System.arraycopy(_data, i, _data, i + 1, _size - i); _data[i] = value; _size++; }
java
public void setLength(int size) { expand(size); for (int i = _size; i < size; i++) _data[i] = 0; _size = size; }
java
public boolean contains(int test) { int []data = _data; for (int i = _size - 1; i >= 0; i--) { if (data[i] == test) return true; } return false; }
java
public boolean isSubset(IntArray subset) { int []subData = subset._data; for (int i = subset._size - 1; i >= 0; i--) { if (! contains(subData[i])) return false; } return true; }
java
public void union(IntArray newArray) { for (int i = 0; i < newArray._size; i++) { if (! contains(newArray._data[i])) add(newArray._data[i]); } }
java
@GET @Path("{id}") public IAgreement getAgreementById(@PathParam("id") String agreementId) throws NotFoundException { logger.debug("StartOf getAgreementById REQUEST for /agreements/" + agreementId); AgreementHelperE agreementRestHelper = getAgreementHelper(); IAgreement agreement = ag...
java
@GET @Path("{id}/context") public eu.atos.sla.parser.data.wsag.Context getAgreementContextById(@PathParam("id") String agreementId) throws NotFoundException, InternalException { logger.debug("StartOf getAgreementContextById REQUEST for /agreements/{}/context", agreementId); AgreementHelperE ag...
java
public static PollTcpManager createJni() { try { /* Class<?> jniSelectManager = SelectManagerJni.class; Method method = jniSelectManager.getMethod("create"); */ return (PollTcpManager) SelectManagerJni.create(); } catch (Throwable e) { // catch Throwable becau...
java
public void onFail() { _lastFailTime = CurrentTime.currentTime(); if (_firstFailTime == 0) { _firstFailTime = _lastFailTime; } _firstSuccessTime = 0; toState(State.FAIL); long recoverTimeout = _dynamicRecoverTimeout.get(); long nextRecoverTimeout = Math.min(recove...
java
public boolean startConnection() { State state = _state.get(); if (state.isActive()) { // when active, always start a connection _connectionCount.incrementAndGet(); return true; } long now = CurrentTime.currentTime(); long lastFailTime = _lastFailTime; ...
java
public void addShort(int offset, int value) { insertCode(offset, 2); _code.set(offset + 0, value >> 8); _code.set(offset + 1, value); }
java
public void add(int offset, byte []buffer, int bufOffset, int length) { insertCode(offset, length); _code.set(offset, buffer, bufOffset, length); }
java
public void update() { byte []code = new byte[_code.size()]; System.arraycopy(_code.getBuffer(), 0, code, 0, _code.size()); _codeAttr.setCode(code); if (_changeLength) { // XXX: really need more sophisticated solution ArrayList<Attribute> attrList = getCodeAttribute().getAttributes(); ...
java
public ServiceRefAmp createLinkService(String path, PodRef podCaller) { StubLink actorLink; String address = _scheme + "//" + _serviceRefOut.address() + path; ServiceRefAmp parentRef = _actorOut.getServiceRef(); if (_queryMapRef != null) { //String addressSelf = "/system"; ...
java
public long get() { long now = CurrentTime.currentTime() / 1000; long oldSequence; long newSequence; do { oldSequence = _sequence.get(); long oldTime = oldSequence >>> _timeOffset; if (oldTime != now) { newSequence = ((now << _timeOffset) ...
java
public static KbServerSideException fromThrowable(Throwable cause) { return (cause instanceof KbServerSideException) ? (KbServerSideException) cause : new KbServerSideException(cause); }
java
public static KbServerSideException fromThrowable(String message, Throwable cause) { return (cause instanceof KbServerSideException && Objects.equals(message, cause.getMessage())) ? (KbServerSideException) cause : new KbServerSideException(message, cause); }
java
public static KbTypeConflictException fromThrowable(Throwable cause) { return (cause instanceof KbTypeConflictException) ? (KbTypeConflictException) cause : new KbTypeConflictException(cause); }
java
public static KbTypeConflictException fromThrowable(String message, Throwable cause) { return (cause instanceof KbTypeConflictException && Objects.equals(message, cause.getMessage())) ? (KbTypeConflictException) cause : new KbTypeConflictException(message, cause); }
java
protected static String intsToCommaDelimitedString(int[] ints) { if (ints == null) { return ""; } StringBuilder result = new StringBuilder(); for (int i = 0; i < ints.length; i++) { result.append(ints[i]); if (i < (ints.length - 1)) { ...
java
public void init(FilterConfig filterConfig) throws ServletException { String comaDelimitedSecuredRemoteAddresses = filterConfig.getInitParameter(SECURED_REMOTE_ADDRESSES_PARAMETER); if (comaDelimitedSecuredRemoteAddresses != null) { setSecuredRemoteAdresses(comaDelimitedSecuredRemoteAddre...
java
public static QueryException fromThrowable(Throwable cause) { return (cause instanceof QueryException) ? (QueryException) cause : new QueryException(cause); }
java
public static QueryException fromThrowable(String message, Throwable cause) { return (cause instanceof QueryException && Objects.equals(message, cause.getMessage())) ? (QueryException) cause : new QueryException(message, cause); }
java
public static SessionServiceException fromThrowable(Class interfaceClass, Throwable cause) { return (cause instanceof SessionServiceException && Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass())) ? (SessionServiceException) cause ...
java
public static SessionServiceException fromThrowable(Class interfaceClass, String message, Throwable cause) { return (cause instanceof SessionServiceException && Objects.equals(interfaceClass, ((SessionServiceException) cause).getInterfaceClass()) && Objects.equals(message, cause.getMessage(...
java
public static KbTypeException fromThrowable(Throwable cause) { return (cause instanceof KbTypeException) ? (KbTypeException) cause : new KbTypeException(cause); }
java
public static KbTypeException fromThrowable(String message, Throwable cause) { return (cause instanceof KbTypeException && Objects.equals(message, cause.getMessage())) ? (KbTypeException) cause : new KbTypeException(message, cause); }
java
public static SessionCommunicationException fromThrowable(Throwable cause) { return (cause instanceof SessionCommunicationException) ? (SessionCommunicationException) cause : new SessionCommunicationException(cause); }
java
public static SessionCommunicationException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionCommunicationException && Objects.equals(message, cause.getMessage())) ? (SessionCommunicationException) cause : new SessionCommunicationException(messag...
java
public static QueryConstructionException fromThrowable(Throwable cause) { return (cause instanceof QueryConstructionException) ? (QueryConstructionException) cause : new QueryConstructionException(cause); }
java
public static QueryConstructionException fromThrowable(String message, Throwable cause) { return (cause instanceof QueryConstructionException && Objects.equals(message, cause.getMessage())) ? (QueryConstructionException) cause : new QueryConstructionException(message, cause); ...
java
public static SessionManagerException fromThrowable(Throwable cause) { return (cause instanceof SessionManagerException) ? (SessionManagerException) cause : new SessionManagerException(cause); }
java
public static SessionManagerException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionManagerException && Objects.equals(message, cause.getMessage())) ? (SessionManagerException) cause : new SessionManagerException(message, cause); }
java
public static InvalidFormulaInContextException fromThrowable(Throwable cause) { return (cause instanceof InvalidFormulaInContextException) ? (InvalidFormulaInContextException) cause : new InvalidFormulaInContextException(cause); }
java
public static InvalidFormulaInContextException fromThrowable(String message, Throwable cause) { return (cause instanceof InvalidFormulaInContextException && Objects.equals(message, cause.getMessage())) ? (InvalidFormulaInContextException) cause : new InvalidFormulaInContextExce...
java
public static InvalidNameException fromThrowable(Throwable cause) { return (cause instanceof InvalidNameException) ? (InvalidNameException) cause : new InvalidNameException(cause); }
java
public static InvalidNameException fromThrowable(String message, Throwable cause) { return (cause instanceof InvalidNameException && Objects.equals(message, cause.getMessage())) ? (InvalidNameException) cause : new InvalidNameException(message, cause); }
java
public static SessionConfigurationException fromThrowable(Throwable cause) { return (cause instanceof SessionConfigurationException) ? (SessionConfigurationException) cause : new SessionConfigurationException(cause); }
java
public static SessionConfigurationException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionConfigurationException && Objects.equals(message, cause.getMessage())) ? (SessionConfigurationException) cause : new SessionConfigurationException(messag...
java
public static SessionInitializationException fromThrowable(Throwable cause) { return (cause instanceof SessionInitializationException) ? (SessionInitializationException) cause : new SessionInitializationException(cause); }
java
public static SessionInitializationException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionInitializationException && Objects.equals(message, cause.getMessage())) ? (SessionInitializationException) cause : new SessionInitializationException(me...
java
public static SessionException fromThrowable(Throwable cause) { return (cause instanceof SessionException) ? (SessionException) cause : new SessionException(cause); }
java
public static SessionException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionException && Objects.equals(message, cause.getMessage())) ? (SessionException) cause : new SessionException(message, cause); }
java
public static VariableArityException fromThrowable(String message, Throwable cause) { return (cause instanceof VariableArityException && Objects.equals(message, cause.getMessage())) ? (VariableArityException) cause : new VariableArityException(message, cause); }
java
public static KbObjectNotFoundException fromThrowable(Throwable cause) { return (cause instanceof KbObjectNotFoundException) ? (KbObjectNotFoundException) cause : new KbObjectNotFoundException(cause); }
java
public static KbObjectNotFoundException fromThrowable(String message, Throwable cause) { return (cause instanceof KbObjectNotFoundException && Objects.equals(message, cause.getMessage())) ? (KbObjectNotFoundException) cause : new KbObjectNotFoundException(message, cause); }
java
public static KbRuntimeException fromThrowable(Throwable cause) { return (cause instanceof KbRuntimeException) ? (KbRuntimeException) cause : new KbRuntimeException(cause); }
java
public static KbRuntimeException fromThrowable(String message, Throwable cause) { return (cause instanceof KbRuntimeException && Objects.equals(message, cause.getMessage())) ? (KbRuntimeException) cause : new KbRuntimeException(message, cause); }
java
public static StaleKbObjectException fromThrowable(Throwable cause) { return (cause instanceof StaleKbObjectException) ? (StaleKbObjectException) cause : new StaleKbObjectException(cause); }
java
public static StaleKbObjectException fromThrowable(String message, Throwable cause) { return (cause instanceof StaleKbObjectException && Objects.equals(message, cause.getMessage())) ? (StaleKbObjectException) cause : new StaleKbObjectException(message, cause); }
java
public static OpenCycUnsupportedFeatureException fromThrowable(Throwable cause) { return (cause instanceof OpenCycUnsupportedFeatureException) ? (OpenCycUnsupportedFeatureException) cause : new OpenCycUnsupportedFeatureException(cause); }
java
public static OpenCycUnsupportedFeatureException fromThrowable(String message, Throwable cause) { return (cause instanceof OpenCycUnsupportedFeatureException && Objects.equals(message, cause.getMessage())) ? (OpenCycUnsupportedFeatureException) cause : new OpenCycUnsupportedFea...
java
public static CreateException fromThrowable(Throwable cause) { return (cause instanceof CreateException) ? (CreateException) cause : new CreateException(cause); }
java
public static CreateException fromThrowable(String message, Throwable cause) { return (cause instanceof CreateException && Objects.equals(message, cause.getMessage())) ? (CreateException) cause : new CreateException(message, cause); }
java
public static SessionManagerConfigurationException fromThrowable(Throwable cause) { return (cause instanceof SessionManagerConfigurationException) ? (SessionManagerConfigurationException) cause : new SessionManagerConfigurationException(cause); }
java
public static SessionManagerConfigurationException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionManagerConfigurationException && Objects.equals(message, cause.getMessage())) ? (SessionManagerConfigurationException) cause : new SessionManagerC...
java
private static boolean isAPortOffset(int offset) { return (offset == STANDARD_ASCII_PORT_OFFSET) || (offset == STANDARD_HTTP_PORT_OFFSET) || (offset == STANDARD_SERVLET_PORT_OFFSET) || (offset == STANDARD_CFASL_PORT_OFFSET); }
java
public static SessionCommandException fromThrowable(Throwable cause) { return (cause instanceof SessionCommandException) ? (SessionCommandException) cause : new SessionCommandException(cause); }
java
public static SessionCommandException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionCommandException && Objects.equals(message, cause.getMessage())) ? (SessionCommandException) cause : new SessionCommandException(message, cause); }
java
public static UnsupportedCycOperationException fromThrowable(Throwable cause) { return (cause instanceof UnsupportedCycOperationException) ? (UnsupportedCycOperationException) cause : new UnsupportedCycOperationException(cause); }
java