id stringlengths 7 14 | text stringlengths 1 106k |
|---|---|
2416378_5 | @Override
public boolean isComplete() {
for (TransactionProcessor processor : processors) {
if (!processor.isComplete()) {
return false;
}
}
return true;
} |
2416378_6 | public String getCanonicalName() {
if (pkg == null) {
return fileName;
}
return pkg + "." + fileName;
} |
2416378_7 | public String getCanonicalName() {
if (pkg == null) {
return fileName;
}
return pkg + "." + fileName;
} |
2416378_8 | public String getCanonicalName() {
if (pkg == null) {
return fileName;
}
return pkg + "." + fileName;
} |
2416378_9 | public PackageClass append(String addName) {
return new PackageClass(pkg, fileName + addName);
} |
2422006_0 | @Override
public void build(String tag, OutputStream os) throws IOException {
if (endsWithPunctuation(tag)) {
os.write(tag.charAt(tag.length() - 1));
tag = tag.substring(0, tag.length() - 2);
}
String url = "<a href=\"https://twitter.com/#!/" + tag + "\">@" + tag + "</a>";
os.write(url.getBytes());
} |
2422006_1 | @Override
public void build(String url, OutputStream os) throws IOException {
String lastChar = url.substring(url.length() - 1);
if (isPunctuation(lastChar)) {
url = url.substring(0, url.length() - 1);
} else {
lastChar = null;
}
String anchorTag = makeAnchor(url, lastChar);
os.write(anchorTag.getBytes());
} |
2422006_2 | @Override
public void build(String tag, OutputStream os) throws IOException {
String url = "<a href=\"https://twitter.com/#!/search/%23" + tag + "\">#" + tag + "</a>";
os.write(url.getBytes());
} |
2422006_3 | @Override
public TweetState processByte(byte b, TweetState currentState) throws Exception {
TweetState retVal = currentState;
if (b == ' ') {
retVal = TweetState.READY; // fix 1
output.build(tagStream.toString(), os);
if (!terminating) {
super.writeByte(' ');
}
reset();
} else {
buf[0] = b;
tagStrea... |
2422006_4 | @Override
public TweetState processByte(byte b, TweetState currentState) throws Exception {
TweetState retVal = currentState;
if (b == ' ') {
retVal = TweetState.READY; // fix 1
output.build(tagStream.toString(), os);
if (!terminating) {
super.writeByte(' ');
}
reset();
} else {
buf[0] = b;
tagStrea... |
2422006_5 | @Override
public TweetState processByte(byte b, TweetState currentState) throws Exception {
TweetState retVal = currentState;
if (b == ' ') {
retVal = TweetState.READY; // fix 1
output.build(tagStream.toString(), os);
if (!terminating) {
super.writeByte(' ');
}
reset();
} else {
buf[0] = b;
tagStrea... |
2422006_6 | @SuppressWarnings("unchecked")
public <T> T getBean(Class<T> clazz) {
return (T) injectionGraph.get(clazz);
} |
2422006_7 | @SuppressWarnings("unchecked")
public <T> T getBean(Class<T> clazz) {
return (T) injectionGraph.get(clazz);
} |
2422006_8 | public boolean isMyComponent() {
return instance.isAnnotationPresent(MyComponent.class);
} |
2422006_9 | public boolean isMyComponent() {
return instance.isAnnotationPresent(MyComponent.class);
} |
2425139_0 | @Name("insert")
@Description("Insert Geoff subgraph into the database from a list of rule strings")
@PluginTarget(GraphDatabaseService.class)
public Representation insert(
@Source GraphDatabaseService graphDB,
@Description("Geoff subgraph to insert")
@Parameter(name = "subgraph", optional = false) String[] subgraph,... |
2432524_0 | public static String generate( Color color )
{
String hexRed = Integer.toHexString( color.getRed() );
String hexGreen = Integer.toHexString( color.getGreen() );
String hexBlue = Integer.toHexString( color.getBlue() );
return String.format( "%2s%2s%2s", hexRed, hexGreen, hexBlue ).replaceAll( " ", "0" ).... |
2432524_1 | public static Color parse( String colorString )
{
if ( colorString == null || colorString.isEmpty() )
{
// invalid arguments won't crash the program and are ignored...
return null;
}
// rgb( 123, 23, 1)
if ( colorString.startsWith( "rgb" ) )
{
return parseRgb( colorString... |
2432524_2 | public static Color parse( String colorString )
{
if ( colorString == null || colorString.isEmpty() )
{
// invalid arguments won't crash the program and are ignored...
return null;
}
// rgb( 123, 23, 1)
if ( colorString.startsWith( "rgb" ) )
{
return parseRgb( colorString... |
2432524_3 | public static SpanProperties createSpanProperties( String style )
{
Map<String, String> stylesMap = StylesHelper.parse( style );
if ( !stylesMap.isEmpty() )
{
SpanProperties properties = new SpanProperties();
processContainerproperties( properties, stylesMap );
return properties;
... |
2432524_4 | public static SpanProperties createSpanProperties( String style )
{
Map<String, String> stylesMap = StylesHelper.parse( style );
if ( !stylesMap.isEmpty() )
{
SpanProperties properties = new SpanProperties();
processContainerproperties( properties, stylesMap );
return properties;
... |
2432524_5 | public static String prettyPrint( String xml )
{
return prettyPrint( xml, INDENT_NUMBER );
} |
2432524_6 | public static String prettyPrint( String xml )
{
return prettyPrint( xml, INDENT_NUMBER );
} |
2434719_0 | @Override
public String toString() {
return type.name() + ": " + getValue();
} |
2434719_1 | public LRAction find(Symbol symbol) {
LRAction result = LRACTION_UNDEFINED;
if (symbol != null) {
for (int i = 0; i < size(); i++) {
LRAction action = get(i);
if (action.getSymbol().tableIndex == symbol.tableIndex) {
result = action;
break;
... |
2434719_2 | public void appendData(String moreData) {
if (text == null) {
text = new StringBuilder();
}
text.append(moreData);
} |
2434719_3 | public Reduction asReduction() {
return data instanceof Reduction ? (Reduction)data : null;
} |
2434719_4 | public String asString() {
return text != null ? text.toString() : data == null ? "" : data.toString();
} |
2434719_5 | public void setState(int state) {
this.state = state;
} |
2434719_6 | public void setPosition(Position position) {
this.position = position;
} |
2434719_7 | public void setSymbol(Symbol symbol) {
setGroup(symbol.getGroup());
setName(symbol.getName());
setType(symbol.getType());
setTableIndex(symbol.getTableIndex());
} |
2434719_8 | public String about() {
return PARSER_NAME + PARSER_VERSION;
} |
2434719_9 | protected boolean loadTables(File file) throws IOException {
if (file == null) {
throw new IOException(FormatHelper.formatMessage("messages", "error.cgt_missing"));
}
return loadTables(toInputStream(file));
} |
2438993_0 | @Override
public void undeploy(DeploymentUnit context) {
final ResourceRoot knobRoot = context.removeAttachment( DESCRIPTOR_ROOT );
if (knobRoot != null) {
final MountHandle mountHandle = knobRoot.getMountHandle();
VFSUtils.safeClose( mountHandle );
}
} |
2438993_1 | public String getContextPath() {
return this.contextPath;
} |
2449032_0 | public Function (String name, int nrOfParameters) {
mName = name;
mNrOfParams = nrOfParameters;
} |
2449032_1 | public final String checkNrOfArgsAndExecute (String[] args) {
if (args.length != mNrOfParams) {
throw new ExecutionException ("function '%s' needs %d arguments, got %d", getName (), mNrOfParams, args.length);
}
return execute (args);
} |
2449032_2 | public final String checkNrOfArgsAndExecute (String[] args) {
if (args.length != mNrOfParams) {
throw new ExecutionException ("function '%s' needs %d arguments, got %d", getName (), mNrOfParams, args.length);
}
return execute (args);
} |
2449032_3 | ; |
2449032_4 | Console () {
this (System.out);
} |
2449032_5 | @Override
public void processTestLine (final TestLine testLine) {
int nrOfParts = testLine.getNrOfParts ();
for (int partNr = 0; partNr < nrOfParts; ++partNr) {
mStream.print ("'" + testLine.getPart (partNr) + "' ");
}
mStream.println ();
} |
2449032_6 | @Override
public void processCommentLine (final String testLine) {
mStream.println ("comment: " + testLine);
} |
2449032_7 | @Override
public void processCommentLine (final String testLine) {
mStream.println ("comment: " + testLine);
} |
2449032_8 | @Override
public void processStackTrace (String[] stackTraceLines) {
mStream.println ("stack trace:");
int nrOfElements = stackTraceLines.length;
for (int elementNr = 0; elementNr < nrOfElements; ++elementNr) {
mStream.println ("\t" + stackTraceLines[elementNr]);
}
} |
2449032_9 | @Override
public void processError (final String error) {
mStream.println ("error: " + error);
} |
2466190_0 | public static File getEncryptedFilename(File file) {
String filename = file.getName();
return filename.endsWith(ENCRYPTED_FILENAME_SUFFIX) ? file : new File(file.getParent(), filename + ENCRYPTED_FILENAME_SUFFIX);
} |
2466190_1 | public static boolean isNullOrEmpty(byte[] array) {
return array == null || array.length == 0;
} |
2466190_2 | public static boolean isNullOrEmpty(byte[] array) {
return array == null || array.length == 0;
} |
2466190_3 | public static boolean isNullOrEmpty(byte[] array) {
return array == null || array.length == 0;
} |
2466190_4 | public static void assertTrue(boolean condition) {
if (imp != null && !condition) {
imp.assertFailed("Expected 'true' but was 'false'");
}
} |
2466190_5 | public static void assertFalse(boolean condition) {
if (imp != null && condition) {
imp.assertFailed("Expected 'false' but was 'true'");
}
} |
2466190_6 | public static void assertNotNull(Object object) {
if (imp != null && object == null) {
imp.assertFailed("Not-null expected");
}
} |
2466190_7 | public static void assertNull(Object object) {
if (imp != null && object != null) {
imp.assertFailed(StringUtils.format("Expected 'null' but was '%s'", object));
}
} |
2466190_8 | public static void assertEquals(Object expected, Object actual) {
if (imp != null && !ObjectUtils.equal(expected, actual)) {
imp.assertFailed(StringUtils.format("Expected '%s' but was '%s'", expected, actual));
}
} |
2466190_9 | @Override
public void onLogMessage(@NonNull ApptentiveLog.Level level, @NonNull String message) {
synchronized (mutex) {
pendingMessages.add(level.getShortName() + ": " + message);
writeQueue.dispatchAsyncOnce(writeQueueTask);
}
} |
2470704_0 | protected float normalize(float score, int longestString){
return 1f - (score / longestString);
} |
2474070_0 | public static Gson createGson(Context context)
{
if (gson == null)
{
GsonBuilder builder = new GsonBuilder();
if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled())
{
builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor());
}
gson = builder.create();
... |
2474070_1 | public static Gson createGson(Context context)
{
if (gson == null)
{
GsonBuilder builder = new GsonBuilder();
if (context == null || Feature.get(context, R.bool.feature_load_old_experiences).isEnabled())
{
builder.registerTypeAdapterFactory(new ExperienceTypeAdapterFactor());
}
gson = builder.create();
... |
247823_10 | Resource buildResource(ClassMetadata metadata) {
Resource r = new Resource();
if (metadata != null) {
Class<?> resClass = metadata.getResourceClass();
if (resClass != null) {
WADLDoc d = resClass.getAnnotation(WADLDoc.class);
if (d != null) {
r.getDoc().ad... |
247823_11 | Method buildMethod(ClassMetadata classMetadata, MethodMetadata metadata) {
Method m = new Method();
m.setName(metadata.getHttpMethod());
java.lang.reflect.Method reflMethod = metadata.getReflectionMethod();
if (reflMethod != null) {
WADLDoc d = reflMethod.getAnnotation(WADLDoc.class);
if... |
247823_12 | Request buildRequest(ClassMetadata classMetadata, MethodMetadata metadata) {
Request r = null;
List<Injectable> params = metadata.getFormalParameters();
if (params != null && params.size() > 0) {
if (r == null) {
r = new Request();
}
boolean hasValidParams = false;
... |
247823_13 | public Application generate(String baseURI, Set<Class<?>> classes) {
/*
* the idea is that classes comes from the Application subclass
*/
Application app = new Application();
if (classes == null || classes.isEmpty()) {
return app;
}
Resources resources = new Resources();
resour... |
247823_14 | public Application generate(String baseURI, Set<Class<?>> classes) {
/*
* the idea is that classes comes from the Application subclass
*/
Application app = new Application();
if (classes == null || classes.isEmpty()) {
return app;
}
Resources resources = new Resources();
resour... |
247823_15 | public static Properties loadSystemProperties(Properties properties) {
String key = null;
String value = null;
Properties systemProperties = new Properties();
// Read the properties contained in passed-in properties
if (properties != null) {
Enumeration<?> keyEnum = properties.propertyNames(... |
247823_16 | public static Properties loadSystemProperties(Properties properties) {
String key = null;
String value = null;
Properties systemProperties = new Properties();
// Read the properties contained in passed-in properties
if (properties != null) {
Enumeration<?> keyEnum = properties.propertyNames(... |
247823_17 | public static Properties loadSystemProperties(Properties properties) {
String key = null;
String value = null;
Properties systemProperties = new Properties();
// Read the properties contained in passed-in properties
if (properties != null) {
Enumeration<?> keyEnum = properties.propertyNames(... |
247823_18 | public static Properties loadSystemProperties(Properties properties) {
String key = null;
String value = null;
Properties systemProperties = new Properties();
// Read the properties contained in passed-in properties
if (properties != null) {
Enumeration<?> keyEnum = properties.propertyNames(... |
247823_19 | protected boolean isReadable(MediaType mediaType) {
return MediaTypeUtils.isXmlType(mediaType);
} |
247823_20 | protected boolean isReadable(MediaType mediaType) {
return MediaTypeUtils.isXmlType(mediaType);
} |
247823_21 | public AcceptCharset fromString(String value) throws IllegalArgumentException {
AcceptCharset cached = cache.get(value);
if (cached != null) {
return cached;
}
List<String> acceptable = new LinkedList<String>();
List<String> banned = new LinkedList<String>();
boolean anyAllowed = (value ... |
247823_22 | public AcceptCharset fromString(String value) throws IllegalArgumentException {
AcceptCharset cached = cache.get(value);
if (cached != null) {
return cached;
}
List<String> acceptable = new LinkedList<String>();
List<String> banned = new LinkedList<String>();
boolean anyAllowed = (value ... |
247823_23 | public AcceptCharset fromString(String value) throws IllegalArgumentException {
AcceptCharset cached = cache.get(value);
if (cached != null) {
return cached;
}
List<String> acceptable = new LinkedList<String>();
List<String> banned = new LinkedList<String>();
boolean anyAllowed = (value ... |
247823_24 | public AcceptCharset fromString(String value) throws IllegalArgumentException {
AcceptCharset cached = cache.get(value);
if (cached != null) {
return cached;
}
List<String> acceptable = new LinkedList<String>();
List<String> banned = new LinkedList<String>();
boolean anyAllowed = (value ... |
247823_25 | public AcceptCharset fromString(String value) throws IllegalArgumentException {
AcceptCharset cached = cache.get(value);
if (cached != null) {
return cached;
}
List<String> acceptable = new LinkedList<String>();
List<String> banned = new LinkedList<String>();
boolean anyAllowed = (value ... |
247823_26 | public AcceptCharset fromString(String value) throws IllegalArgumentException {
AcceptCharset cached = cache.get(value);
if (cached != null) {
return cached;
}
List<String> acceptable = new LinkedList<String>();
List<String> banned = new LinkedList<String>();
boolean anyAllowed = (value ... |
247823_27 | public EntityTag fromString(String eTag) throws IllegalArgumentException {
if (eTag == null) {
throw new IllegalArgumentException(Messages.getMessage("variableIsNull", "eTag")); //$NON-NLS-1$ //$NON-NLS-2$
}
// Remove leading and trailing white spaces
eTag = eTag.trim();
boolean weak = false... |
247823_28 | public String toString(EntityTag eTag) {
if (eTag == null) {
throw new IllegalArgumentException(Messages.getMessage("variableIsNull", "eTag")); //$NON-NLS-1$ //$NON-NLS-2$
}
StringBuilder builder = new StringBuilder();
if (eTag.isWeak()) {
builder.append("W/"); //$NON-NLS-1$
}
bu... |
247823_29 | public NewCookie fromString(String cookie) throws IllegalArgumentException {
if (cookie == null) {
throw new IllegalArgumentException(Messages.getMessage("cookieIsNull")); //$NON-NLS-1$
}
String tokens[] = cookie.split(";"); //$NON-NLS-1$
ModifiableCookie modifiableCookie = null;
for (String... |
247823_30 | public String toString(NewCookie cookie) {
if (cookie == null) {
throw new IllegalArgumentException(Messages.getMessage("cookieIsNull")); //$NON-NLS-1$
}
return buildCookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie
.getDomain(), cookie.getVersion(), cookie.getComment(), c... |
247823_31 | public Date fromString(String date) throws IllegalArgumentException {
if (date == null) {
throw new IllegalArgumentException(Messages.getMessage("variableIsNull", "date")); //$NON-NLS-1$ //$NON-NLS-2$
}
return HttpDateParser.parseHttpDate(date);
} |
247823_32 | public String toString(Date date) {
if (date == null) {
throw new IllegalArgumentException(Messages.getMessage("variableIsNull", "date")); //$NON-NLS-1$ //$NON-NLS-2$
}
return HttpDateParser.toHttpDate(date);
} |
247823_33 | public String toString(CacheControl header) {
if (header == null)
throw new IllegalArgumentException(Messages.getMessage("headerIsNull", "CacheControl")); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer cacheControlHeader = new StringBuffer();
if (header.isPrivate()) {
appendDirectiveWithValues(cac... |
247823_34 | public CacheControl fromString(String value) throws IllegalArgumentException {
throw new UnsupportedOperationException(
Messages.getMessage("jaxrsCacheControlTypeSupport")); //$NON-NLS-1$
} |
247823_35 | public Cookie fromString(String cookie) throws IllegalArgumentException {
if (cookie == null) {
throw new IllegalArgumentException(Messages.getMessage("headerIsNull", "Cookie")); //$NON-NLS-1$ //$NON-NLS-2$
}
String tokens[] = cookie.split("[;,]"); //$NON-NLS-1$
if (tokens.length <= 0) {
... |
247823_36 | public String toString(Cookie cookie) {
if (cookie == null) {
throw new IllegalArgumentException(Messages.getMessage("headerIsNull", "Cookie")); //$NON-NLS-1$ //$NON-NLS-2$
}
StringBuilder cookieHeader = new StringBuilder();
cookieHeader.append(VERSION + "=").append(cookie.getVersion()).append('... |
247823_37 | public static String getCharset(MediaType m) {
return getCharset(m, null);
} |
247823_38 | public static Reader createReader(InputStream stream, MediaType mediaType) {
Charset charset = Charset.forName(getCharset(mediaType));
return new InputStreamReader(stream, charset);
} |
247823_39 | public ServerMessageContext(HttpServletRequest servletRequest,
HttpServletResponse servletResponse,
DeploymentConfiguration configuration) {
this.httpMethod =
buildHttpMethod(configuration.getHttpMethodOverrideHeaders(), servletRequest);
this.... |
247823_40 | public void init(Properties props) {
/* do nothing */
} |
247823_41 | public void init(Properties props) {
/* do nothing */
} |
2478263_0 | @Override
public DOI getDOI() {
return CitationUtil.getDOI(this);
} |
2478263_1 | public static String getLastCommitSHA1(String baseUrl) throws IOException {
return getLastCommitSHA1(baseUrl, new BasicResponseHandler());
} |
2478263_2 | public static Triple<Taxon, NameType, Taxon> parse(String line) {
String[] strings = CSVTSVUtil.splitTSV(line);
Taxon provided = parseProvidedTaxon(strings);
Taxon resolved = parseResolvedTaxon(strings);
// erase unlikely id
if (ExternalIdUtil.isUnlikelyId(provided.getExternalId())) {
provid... |
2478263_3 | @Override
public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException {
lazyInit();
for (Term term : terms) {
String nodeIdAndName = term.getName();
Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null;
... |
2478263_4 | @Override
public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException {
lazyInit();
for (Term term : terms) {
String nodeIdAndName = term.getName();
Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null;
... |
2478263_5 | public void setMaxTaxonLinks(int maxTaxonLinks) {
this.maxTaxonLinks = maxTaxonLinks;
} |
2478263_6 | @Override
public void match(List<Term> terms, TermMatchListener termMatchListener) throws PropertyEnricherException {
lazyInit();
for (Term term : terms) {
String nodeIdAndName = term.getName();
Long nodeId = term instanceof TermRequestImpl ? ((TermRequestImpl) term).getNodeId() : null;
... |
2478263_7 | protected static String contentToString(URI uri) throws IOException {
String response;
if ("file".equals(uri.getScheme()) || "jar".equals(uri.getScheme())) {
response = IOUtils.toString(uri.toURL(), StandardCharsets.UTF_8);
} else {
response = HttpUtil.getContent(uri);
}
return respo... |
2478263_8 | @Override
public Interaction createInteraction(Study study) throws NodeFactoryException {
InteractionNode interactionNode;
try (Transaction transaction = graphDb.beginTx()) {
Node node = graphDb.createNode();
StudyNode studyNode = getOrCreateStudy(study);
interactionNode = new Interactio... |
2478263_9 | @Override
public LocationNode getOrCreateLocation(org.eol.globi.domain.Location location) throws NodeFactoryException {
LocationNode locationNode = findLocation(location);
if (null == locationNode) {
locationNode = createLocation(location);
}
return locationNode;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.