id
stringlengths
7
14
text
stringlengths
1
106k
2349183_2
public static <E extends CoreAttrs> E setSelector(E e, String selector) { String[] res = parseSelector(selector); if (res[S_ID] != null) { e.$id(res[S_ID]); } if (res[S_CLASS] != null) { e.$class(res[S_CLASS]); } return e; }
2349183_3
public static <E extends LINK> E setLinkHref(E e, String href) { if (href.endsWith(".css")) { e.$rel("stylesheet"); // required in html5 } e.$href(href); return e; }
2349183_4
public static <E extends SCRIPT> E setScriptSrc(E e, String src) { if (src.endsWith(".js")) { e.$type("text/javascript"); // required in html4 } e.$src(src); return e; }
2349183_5
public Hamlet(PrintWriter out, int nestLevel, boolean wasInline) { super(out, nestLevel, wasInline); }
2349183_6
@Override public TABLE<TD<T>> table() { closeAttrs(); return table_(this, false); }
2349183_7
public void stop() { try { checkNotNull(httpServer, "httpServer").stop(); checkNotNull(guiceFilter, "guiceFilter").destroy(); } catch (Exception e) { throw new WebAppException(e); } }
2349183_8
public void stop() { try { checkNotNull(httpServer, "httpServer").stop(); checkNotNull(guiceFilter, "guiceFilter").destroy(); } catch (Exception e) { throw new WebAppException(e); } }
2349183_9
static void start(Keys key, String value, StringBuilder b) { b.append(key.name()).append(AuditConstants.KEY_VAL_SEPARATOR).append(value); }
2349728_0
public static Repository eventRepoToRepo(GitHubEvent.RepoIdentifier repo) { String[] ref = repo.repoWithUserName().split("/"); return InfoUtils.createRepoFromData(ref[0], ref[1]); }
2349728_1
public static Repository eventRepoToRepo(GitHubEvent.RepoIdentifier repo) { String[] ref = repo.repoWithUserName().split("/"); return InfoUtils.createRepoFromData(ref[0], ref[1]); }
235076_10
@Override public void harvest() { harvest(MCA_REGISTRY.OSMGeoSource.getURI(), new OpenStreetMapResponseHandlerImpl()); }
235076_11
@Override public void harvest() { harvest(MCA_REGISTRY.XmlSource.getURI()); }
235076_12
@Override public void harvest() { harvest(MCA_REGISTRY.FeedSource.getURI(), new FeedResponseHandlerImpl()); }
235076_13
public boolean isRecurring() { if (this._freq != null && (_until != null || _count > -1 || this._byDay.size() > 0 || this._byMonth.size() > 0)) { return true; } return false; }
235076_14
@Override protected String calculateKey(HttpServletRequest httpRequest) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(httpRequest.getRequestURI()).append(httpRequest.getQueryString()); if (httpRequest.getHeader("accept") != null) { String accept = httpRequest.getHeader("accep...
235076_15
@Override protected String calculateKey(HttpServletRequest httpRequest) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(httpRequest.getRequestURI()).append(httpRequest.getQueryString()); if (httpRequest.getHeader("accept") != null) { String accept = httpRequest.getHeader("accep...
235076_16
@Override protected String calculateKey(HttpServletRequest httpRequest) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(httpRequest.getRequestURI()).append(httpRequest.getQueryString()); if (httpRequest.getHeader("accept") != null) { String accept = httpRequest.getHeader("accep...
235076_17
@Override protected String calculateKey(HttpServletRequest httpRequest) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(httpRequest.getRequestURI()).append(httpRequest.getQueryString()); if (httpRequest.getHeader("accept") != null) { String accept = httpRequest.getHeader("accep...
235076_18
@Override protected String calculateKey(HttpServletRequest httpRequest) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(httpRequest.getRequestURI()).append(httpRequest.getQueryString()); if (httpRequest.getHeader("accept") != null) { String accept = httpRequest.getHeader("accep...
2357859_0
@Override public WorkObject validateType() throws FedoraException { if (!isType(Cdr.Work.toString())) { throw new ObjectTypeMismatchException("Object " + pid + " is not a Work object."); } return this; }
2357859_1
@Override public WorkObject validateType() throws FedoraException { if (!isType(Cdr.Work.toString())) { throw new ObjectTypeMismatchException("Object " + pid + " is not a Work object."); } return this; }
2357859_2
public void setPrimaryObject(PID primaryPid) { RepositoryObject primaryObj = driver.getRepositoryObject(primaryPid); if (!(primaryObj instanceof FileObject)) { throw new InvalidOperationForObjectType("Cannot set " + primaryPid.getUUID() + " as primary object, since objects of type " + pr...
2357859_3
public void setPrimaryObject(PID primaryPid) { RepositoryObject primaryObj = driver.getRepositoryObject(primaryPid); if (!(primaryObj instanceof FileObject)) { throw new InvalidOperationForObjectType("Cannot set " + primaryPid.getUUID() + " as primary object, since objects of type " + pr...
2357859_4
public void setPrimaryObject(PID primaryPid) { RepositoryObject primaryObj = driver.getRepositoryObject(primaryPid); if (!(primaryObj instanceof FileObject)) { throw new InvalidOperationForObjectType("Cannot set " + primaryPid.getUUID() + " as primary object, since objects of type " + pr...
2357859_5
public void clearPrimaryObject() { repoObjFactory.deleteProperty(this, Cdr.primaryObject); }
2357859_6
public FileObject getPrimaryObject() { Resource resc = getResource(); // Find the primary object relation if it is present Statement primaryStmt = resc.getProperty(Cdr.primaryObject); if (primaryStmt == null) { return null; } PID primaryPid = PIDs.get(primaryStmt.getResource().getURI());...
2357859_7
public FileObject getPrimaryObject() { Resource resc = getResource(); // Find the primary object relation if it is present Statement primaryStmt = resc.getProperty(Cdr.primaryObject); if (primaryStmt == null) { return null; } PID primaryPid = PIDs.get(primaryStmt.getResource().getURI());...
2357859_8
@Override public ContentContainerObject addMember(ContentObject member) throws ObjectTypeMismatchException { if (!(member instanceof FileObject)) { throw new ObjectTypeMismatchException("Cannot add object of type " + member.getClass().getName() + " as a member of WorkObject " + pid.getQualif...
2357859_9
@Override public ContentContainerObject addMember(ContentObject member) throws ObjectTypeMismatchException { if (!(member instanceof FileObject)) { throw new ObjectTypeMismatchException("Cannot add object of type " + member.getClass().getName() + " as a member of WorkObject " + pid.getQualif...
2364987_0
@Override public int getDDVPoolMod() { int mod = 0; for (HeroStatsModifiers modifier : modifiers) { mod += modifier.getDDVPoolMod(); } return mod; }
2364987_1
@Override public int getJoinBattleMod() { int mod = 0; for (HeroStatsModifiers modifier : modifiers) { mod += modifier.getJoinBattleMod(); } return mod; }
2364987_2
@Override public int getJoinDebateMod() { int mod = 0; for (HeroStatsModifiers modifier : modifiers) { mod += modifier.getJoinDebateMod(); } return mod; }
2364987_3
@Override public int getJoinWarMod() { int mod = 0; for (HeroStatsModifiers modifier : modifiers) { mod += modifier.getJoinWarMod(); } return mod; }
2364987_4
@Override public int getMDDVPoolMod() { int mod = 0; for (HeroStatsModifiers modifier : modifiers) { mod += modifier.getMDDVPoolMod(); } return mod; }
2364987_5
@Override public int getMobilityPenalty() { int mod = 0; for (HeroStatsModifiers modifier : modifiers) { mod += modifier.getMobilityPenalty(); } return mod; }
2364987_6
@Override public int getMPDVPoolMod() { int mod = 0; for (HeroStatsModifiers modifier : modifiers) { mod += modifier.getMPDVPoolMod(); } return mod; }
2364987_7
@SuppressWarnings("unchecked") public <C extends SubContent> ReportContentFactory<C> getFactory(Class<C> contentClass) { return map.get(contentClass); }
2364987_8
public EncoderFactory findFactory(ReportSession session, String... ids) { for (String id : ids) { for (EncoderFactory factory : factoryById.get(id)) { BasicContent basicContent = session.createContent(BasicContent.class); if (factory.supports(basicContent)) { return factory; } } } ...
2364987_9
public boolean isGreaterThan(NumericValue value) { return this.value.isGreaterThan(value); }
2383782_0
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_1
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_2
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_3
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_4
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_5
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_6
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_7
static Result check(FileSystem fs, Path path) { if (fs instanceof DistributedFileSystem && supportsErasureCoding()) { System.out.println("Found Hadoop that supports Erasure Coding. Trying to disable Erasure Coding for path: "+ path); DistributedFileSystem dfs = (DistributedFileSystem) fs; fi...
2383782_8
void storeLastWorkflows(final File outputDir, int numWorkflows, int maxChildActions) { if (numWorkflows == 0) { return; } try { final List<WorkflowJob> jobs = client.getJobsInfo(null, 0, numWorkflows); for (WorkflowJob job : jobs) { storeWorkflowJobDetails(outputDir, job....
2383782_9
void storeLastCoordinators(final File outputDir, int numCoordinators, int maxChildActions) { if (numCoordinators == 0) { return; } try { final List<CoordinatorJob> jobs = client.getCoordJobsInfo(null, 0, numCoordinators); for (CoordinatorJob job : jobs) { getCoordJob(outp...
2389245_0
public static File chop(final File original, final long tailToKeep) { if (!original.isFile()) { throw new IllegalArgumentException("Cannot behead directories: " + original); } File truncatedFile = new File(original.getParentFile(), original.getName() + ".truncated"); FileChannel whole = null; ...
2389245_1
public static File chop(final File original, final long tailToKeep) { if (!original.isFile()) { throw new IllegalArgumentException("Cannot behead directories: " + original); } File truncatedFile = new File(original.getParentFile(), original.getName() + ".truncated"); FileChannel whole = null; ...
2389245_2
public static File chop(final File original, final long tailToKeep) { if (!original.isFile()) { throw new IllegalArgumentException("Cannot behead directories: " + original); } File truncatedFile = new File(original.getParentFile(), original.getName() + ".truncated"); FileChannel whole = null; ...
2389245_5
public static String asRawVersion(String version, String timestamp, String sequence) { StringBuilder buff = new StringBuilder(); if (version == null) { version = VersionSupport.UNKNOWN; } buff.append(version); if (timestamp != null) { buff.append(",").append(timestamp); } if ...
2389245_6
public static String asRawVersion(String version, String timestamp, String sequence) { StringBuilder buff = new StringBuilder(); if (version == null) { version = VersionSupport.UNKNOWN; } buff.append(version); if (timestamp != null) { buff.append(",").append(timestamp); } if ...
2389245_7
public static String asCanonicalVersion(String version, String timestamp, String sequence) { String derivedVersion = version; if (derivedVersion == null) { derivedVersion = VersionSupport.UNKNOWN; } String snapshot = "-SNAPSHOT"; if (derivedVersion.contains(snapshot)) { derivedVersio...
2389245_8
public static String asCanonicalVersion(String version, String timestamp, String sequence) { String derivedVersion = version; if (derivedVersion == null) { derivedVersion = VersionSupport.UNKNOWN; } String snapshot = "-SNAPSHOT"; if (derivedVersion.contains(snapshot)) { derivedVersio...
2389245_9
public boolean isRunSequentially() { return CascadingUtil.getBooleanProjectProperty(this, RUN_SEQUENTIALLY_PROPERTY_NAME).getValue(); }
2394379_0
static String convertOrderByToSql(Document orderBy) { StringBuilder orderBySql = new StringBuilder(); if (orderBy != null && !orderBy.isEmpty()) { orderBySql.append("ORDER BY"); int num = 0; for (String key : orderBy.keySet()) { if (num > 0) { orderBySql.appen...
2394379_1
public static String toDataKey(String key) { if (!key.matches("^[a-zA-Z0-9_.]+$")) { throw new IllegalArgumentException("Illegal key: " + key); } List<String> keys = Arrays.asList(key.split("\\.")); StringBuilder sb = new StringBuilder("data"); for (int i = 0; i < keys.size(); i++) { ...
2394379_2
public static String toQueryValue(Object queryValue) { Objects.requireNonNull(queryValue); if (queryValue instanceof String) { return (String) queryValue; } else if (queryValue instanceof Number) { if (((Number) queryValue).doubleValue() == -0.0) { return "0"; } S...
2394379_3
String createSelectStatement(Map<String, Object> keyValues) { return "SELECT id FROM " + fullCollectionName + " WHERE " + keyValues.entrySet().stream() .map(entry -> { String dataKey = PostgresqlUtils.toDataKey(entry.getKey()); if (!isSparse() && entry.getValue() ...
2394379_4
@Override public Iterator<Document> iterator() { if (!reversed) { return new DocumentIterator(documents); } else { return new ReverseDocumentIterator(documents); } }
2394379_5
public static NoopOplog get() { return INSTANCE; }
2394379_6
@Override public String toString() { return getClass().getSimpleName() + "[" + getHexData() + "]"; }
2394379_7
public String getHexData() { StringBuilder sb = new StringBuilder(); for (byte b : data) { sb.append(String.format("%02x", b)); } return sb.toString(); }
2394379_8
@Override public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof Document)) { return false; } List<String> keys = new ArrayList<>(keySet()); List<String> otherKeys = new ArrayList<>(((Document) o).keyS...
2394379_9
@Override @SuppressWarnings("unchecked") public Document clone() { return new Document((Map<String, Object>) documentAsMap.clone()); }
2397476_0
public DateTime getValue() { return value; }
2403733_0
public static Iso7816TLV readSingle(byte[] data, boolean recursive) throws IOException { return readSingle(ByteBuffer.wrap(data), recursive); }
2403733_1
public PromoteKeyResult execute(long masterKeyId, byte[] cardAid, long[] subKeyIds) { OperationLog log = new OperationLog(); log.add(LogType.MSG_PR, 0); // Perform actual type change UncachedKeyRing promotedRing; { try { log.add(LogType.MSG_PR_FETCHING, 1, Key...
2403733_2
public PromoteKeyResult execute(long masterKeyId, byte[] cardAid, long[] subKeyIds) { OperationLog log = new OperationLog(); log.add(LogType.MSG_PR, 0); // Perform actual type change UncachedKeyRing promotedRing; { try { log.add(LogType.MSG_PR_FETCHING, 1, Key...
2403733_3
public PromoteKeyResult execute(long masterKeyId, byte[] cardAid, long[] subKeyIds) { OperationLog log = new OperationLog(); log.add(LogType.MSG_PR, 0); // Perform actual type change UncachedKeyRing promotedRing; { try { log.add(LogType.MSG_PR_FETCHING, 1, Key...
2403733_4
public CertifyResult execute(CertifyActionsParcel parcel, CryptoInputParcel cryptoInput) { OperationLog log = new OperationLog(); log.add(LogType.MSG_CRT, 0); // Retrieve and unlock secret key CanonicalizedSecretKey certificationKey; try { log.add(LogType.MSG_CRT_MASTER_FETCH, 1); Ca...
2403733_5
public CertifyResult execute(CertifyActionsParcel parcel, CryptoInputParcel cryptoInput) { OperationLog log = new OperationLog(); log.add(LogType.MSG_CRT, 0); // Retrieve and unlock secret key CanonicalizedSecretKey certificationKey; try { log.add(LogType.MSG_CRT_MASTER_FETCH, 1); Ca...
2403733_6
public CertifyResult execute(CertifyActionsParcel parcel, CryptoInputParcel cryptoInput) { OperationLog log = new OperationLog(); log.add(LogType.MSG_CRT, 0); // Retrieve and unlock secret key CanonicalizedSecretKey certificationKey; try { log.add(LogType.MSG_CRT_MASTER_FETCH, 1); Ca...
2403733_7
public CertifyResult execute(CertifyActionsParcel parcel, CryptoInputParcel cryptoInput) { OperationLog log = new OperationLog(); log.add(LogType.MSG_CRT, 0); // Retrieve and unlock secret key CanonicalizedSecretKey certificationKey; try { log.add(LogType.MSG_CRT_MASTER_FETCH, 1); Ca...
2403733_8
public PgpEditKeyResult modifySecretKeyRing(CanonicalizedSecretKeyRing wsKR, CryptoInputParcel cryptoInput, SaveKeyringParcel saveParcel) { OperationLog log = new OperationLog(); int indent = 0; /* * 1. Unlock priva...
2403733_9
public PgpEditKeyResult modifySecretKeyRing(CanonicalizedSecretKeyRing wsKR, CryptoInputParcel cryptoInput, SaveKeyringParcel saveParcel) { OperationLog log = new OperationLog(); int indent = 0; /* * 1. Unlock priva...
240466_10
public Iterator<Entry> iterator() { return new JarIterator(); }
240466_11
public Iterator<Entry> iterator() { return new ArchiveIterator(this, _iterator()); }
240466_12
public InputStream getBytecode(String className) throws IOException, ClassNotFoundException { int pos = className.indexOf("<"); if (pos > -1) { className = className.substring(0, pos); } pos = className.indexOf(">"); if (pos > -1) { className = className.substring(0, pos); } ...
240466_13
public Class<?> loadClass(String className) throws ClassNotFoundException { // we assume the loader supports mjar if needed, do we want to wrap it to enforce it? // probably not otherwise runtime will be weird and unexpected no? return loader.loadClass(className); }
240466_14
public Iterator<Entry> iterator() { return new ArchiveIterator(this, _iterator()); }
240466_15
public static boolean isNative(final URL url) { final File file = Files.toFile(url); if (file != null) { final String name = file.getName(); if (!name.endsWith(".jar") && !file.isDirectory() && name.contains(".so") && file.getAbsolutePath().startsWith("/usr/lib")) { r...
240466_16
public static Set<URL> findUrls(final ClassLoader classLoader) throws IOException { if (classLoader == null || (SYSTEM.getParent() != null && classLoader == SYSTEM.getParent())) { return Collections.emptySet(); } final Set<URL> urls = new HashSet<URL>(); if (URLClassLoader.class.isInstance(clas...
2408915_0
public Prop parse(Tag tag) { ing[] parts = tag.text().split(";", 3); ((parts.length != 3) || Strings.containNullOrEmptyElement(parts)) { throw new RuntimeException("Invalid prop tag format '" + tag.text() + "', expected format @prop [name]; [supported type description]; [two-way?]"); urn new Prop(parts[0], parts[1],...
2408915_1
public Prop parse(Tag tag) { ing[] parts = tag.text().split(";", 3); ((parts.length != 3) || Strings.containNullOrEmptyElement(parts)) { throw new RuntimeException("Invalid prop tag format '" + tag.text() + "', expected format @prop [name]; [supported type description]; [two-way?]"); urn new Prop(parts[0], parts[1],...
2408915_2
public ResolvedGroupAttributes resolve(PendingGroupAttributes pendingGroupAttributes, ChildAttributesResolver childAttributesResolver) { pendingGroupAttributes.assertAttributesArePresent(childAttributesResolver.getCompulsoryAttributes()); ChildAttributeResolverMappings resolverMappings = createResolverMappings(childA...
2408915_3
@Override public void add(String attributeName, ChildViewAttribute childAttribute) { AbstractAttribute attribute = resolvedGroupAttributes.attributeFor(attributeName); childViewAttributeInitializer.initializeChildViewAttribute(childAttribute, attribute); childViewAttributeMap.put(attributeName, childAttribute); }
2408915_4
@Override public void add(String attributeName, ChildViewAttribute childAttribute) { AbstractAttribute attribute = resolvedGroupAttributes.attributeFor(attributeName); childViewAttributeInitializer.initializeChildViewAttribute(childAttribute, attribute); childViewAttributeMap.put(attributeName, childAttribute); }
2408915_5
static <T extends Object> T newViewAttribute(Class<T> viewAttributeClass) { try { return viewAttributeClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("View Attribute class " + viewAttributeClass.getName() + " could not be instantiated: " + e); } catch (IllegalAccessException ...
2408915_6
static <T extends Object> T newViewAttribute(Class<T> viewAttributeClass) { try { return viewAttributeClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("View Attribute class " + viewAttributeClass.getName() + " could not be instantiated: " + e); } catch (IllegalAccessException ...
2408915_7
static <T extends Object> T newViewAttribute(Class<T> viewAttributeClass) { try { return viewAttributeClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("View Attribute class " + viewAttributeClass.getName() + " could not be instantiated: " + e); } catch (IllegalAccessException ...
2408915_8
public void turnOff() { state = State.NEUTRAL; }
2408915_9
@Override public void bindTo(BindingContext bindingContext) { try { initializeViewAttributeBinder(bindingContext); performBind(bindingContext); } catch (RuntimeException e) { throw new AttributeBindingException(attribute.getName(), e); } }
2416378_0
@Override public boolean isComplete() { return beforeProcessor.isComplete() && afterProcessor.isComplete(); }
2416378_1
public Exception getError() { return worker == null ? null : worker.getError(); }
2416378_2
public void execute() { ExecutorService executorService = MoreExecutors.sameThreadExecutor(); for (Transaction<V, R> transaction : transactions) { if (!transaction.isComplete()) { executorService.execute(transaction); } } try { executorService.shutdown(); exec...
2416378_3
@Override public void execute() { for (TransactionProcessor processor : processors) { processor.execute(); } }
2416378_4
@Override public boolean isComplete() { for (TransactionProcessor processor : processors) { if (!processor.isComplete()) { return false; } } return true; }