id stringlengths 7 14 | text stringlengths 1 106k |
|---|---|
918574_7 | static String replaceSlashes(final String target) {
String replaced = target;
if (replaced != null) {
replaced = replaced.replaceAll("/+", "/");
}
return replaced;
} |
918574_8 | static String replaceSlashes(final String target) {
String replaced = target;
if (replaced != null) {
replaced = replaced.replaceAll("/+", "/");
}
return replaced;
} |
918574_9 | static String replaceSlashes(final String target) {
String replaced = target;
if (replaced != null) {
replaced = replaced.replaceAll("/+", "/");
}
return replaced;
} |
921110_0 | @Override
public Map<String, JsonBall> apply(Multimap<String, Supplier<JsonBall>> from) {
Map<String, JsonBall> autoAttrs = mergeSameKeys(from);
Map<String, JsonBall> modifiableFlatMap = Maps.newLinkedHashMap(Maps.filterKeys(autoAttrs,
new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.indexOf('/') == -1;
}
}));
Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
JsonBall toInsert = entry.getValue();
try {
putUnderContext(keyParts, toInsert, modifiableFlatMap);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
}
}
return modifiableFlatMap;
} |
921110_1 | @Override
public Map<String, JsonBall> apply(Multimap<String, Supplier<JsonBall>> from) {
Map<String, JsonBall> autoAttrs = mergeSameKeys(from);
Map<String, JsonBall> modifiableFlatMap = Maps.newLinkedHashMap(Maps.filterKeys(autoAttrs,
new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.indexOf('/') == -1;
}
}));
Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
JsonBall toInsert = entry.getValue();
try {
putUnderContext(keyParts, toInsert, modifiableFlatMap);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
}
}
return modifiableFlatMap;
} |
921110_2 | @Override
public Map<String, JsonBall> apply(Multimap<String, Supplier<JsonBall>> from) {
Map<String, JsonBall> autoAttrs = mergeSameKeys(from);
Map<String, JsonBall> modifiableFlatMap = Maps.newLinkedHashMap(Maps.filterKeys(autoAttrs,
new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.indexOf('/') == -1;
}
}));
Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
JsonBall toInsert = entry.getValue();
try {
putUnderContext(keyParts, toInsert, modifiableFlatMap);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
}
}
return modifiableFlatMap;
} |
921110_3 | @Override
public Map<String, JsonBall> apply(Multimap<String, Supplier<JsonBall>> from) {
Map<String, JsonBall> autoAttrs = mergeSameKeys(from);
Map<String, JsonBall> modifiableFlatMap = Maps.newLinkedHashMap(Maps.filterKeys(autoAttrs,
new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.indexOf('/') == -1;
}
}));
Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
JsonBall toInsert = entry.getValue();
try {
putUnderContext(keyParts, toInsert, modifiableFlatMap);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
}
}
return modifiableFlatMap;
} |
921110_4 | @Override
public Map<String, JsonBall> apply(Multimap<String, Supplier<JsonBall>> from) {
Map<String, JsonBall> autoAttrs = mergeSameKeys(from);
Map<String, JsonBall> modifiableFlatMap = Maps.newLinkedHashMap(Maps.filterKeys(autoAttrs,
new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.indexOf('/') == -1;
}
}));
Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
JsonBall toInsert = entry.getValue();
try {
putUnderContext(keyParts, toInsert, modifiableFlatMap);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
}
}
return modifiableFlatMap;
} |
921110_5 | @Override
public Map<String, JsonBall> apply(Multimap<String, Supplier<JsonBall>> from) {
Map<String, JsonBall> autoAttrs = mergeSameKeys(from);
Map<String, JsonBall> modifiableFlatMap = Maps.newLinkedHashMap(Maps.filterKeys(autoAttrs,
new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.indexOf('/') == -1;
}
}));
Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
JsonBall toInsert = entry.getValue();
try {
putUnderContext(keyParts, toInsert, modifiableFlatMap);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
}
}
return modifiableFlatMap;
} |
921110_6 | @Override
public Map<String, JsonBall> apply(Multimap<String, Supplier<JsonBall>> from) {
Map<String, JsonBall> autoAttrs = mergeSameKeys(from);
Map<String, JsonBall> modifiableFlatMap = Maps.newLinkedHashMap(Maps.filterKeys(autoAttrs,
new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.indexOf('/') == -1;
}
}));
Map<String, JsonBall> withSlashesMap = Maps.difference(autoAttrs, modifiableFlatMap).entriesOnlyOnLeft();
for (Entry<String, JsonBall> entry : withSlashesMap.entrySet()) {
List<String> keyParts = Lists.newArrayList(Splitter.on('/').split(entry.getKey()));
JsonBall toInsert = entry.getValue();
try {
putUnderContext(keyParts, toInsert, modifiableFlatMap);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("error inserting value in entry: " + entry.getKey(), e);
}
}
return modifiableFlatMap;
} |
921110_7 | @Override
public Node execute(Node node) {
logger.trace("creating node %s", node.getName());
node.getAutomatic().putAll(automaticSupplier.get());
chef.createNode(node);
logger.debug("created node %s", node.getName());
return node;
} |
921110_8 | @Override
public void execute(String nodeName) {
logger.trace("updating node %s", nodeName);
Node node = chef.getNode(nodeName);
Node mutable = new Node(node.getName(), node.getNormal(), node.getOverride(), node.getDefault(),
automaticSupplier.get(), node.getRunList(), node.getChefEnvironment());
chef.updateNode(mutable);
logger.debug("updated node %s", nodeName);
} |
921110_9 | public static String findRoleInRunList(List<String> runList) {
final Pattern pattern = Pattern.compile("^role\\[(.*)\\]$");
String roleToParse = Iterables.find(runList, new Predicate<String>() {
@Override
public boolean apply(String input) {
return pattern.matcher(input).matches();
}
});
Matcher matcher = pattern.matcher(roleToParse);
matcher.find();
return matcher.group(1);
} |
922437_0 | public static DaoTransaction createAndPersist(final DaoInternalAccount from, final DaoAccount to, final BigDecimal amount)
throws NotEnoughMoneyException {
final Session session = SessionManager.getSessionFactory().getCurrentSession();
final DaoTransaction transaction = new DaoTransaction(from, to, amount);
try {
session.save(transaction);
} catch (final HibernateException e) {
session.getTransaction().rollback();
SessionManager.getSessionFactory().getCurrentSession().beginTransaction();
throw e;
}
return transaction;
} |
922437_1 | public void addVersion(final String content, final DaoMember author) {
this.currentVersion = new DaoStringVersion(content, this, author);
versions.add(currentVersion);
} |
922437_2 | public void compact() {
String previousContent = null;
for (final DaoStringVersion version : versions) {
if (!version.isCompacted()) {
final String savedContent = version.getContent();
if (previousContent != null) {
version.compact(previousContent);
}
previousContent = savedContent;
} else {
if (previousContent == null) {
throw new BadProgrammerException("First string version should never be compacted !");
}
previousContent = version.getContentUncompacted(previousContent);
}
}
} |
922437_3 | public static DaoDescription createAndPersist(final DaoMember member,
final DaoTeam team,
final Language language,
final String title,
final String description) {
final Session session = SessionManager.getSessionFactory().getCurrentSession();
if (member == null || language == null || title == null || title.isEmpty() || description == null || description.isEmpty()) {
throw new NonOptionalParameterException();
}
final DaoDescription descr = new DaoDescription(member, team, language, title, description);
try {
session.save(descr);
} catch (final HibernateException e) {
session.getTransaction().rollback();
SessionManager.getSessionFactory().getCurrentSession().beginTransaction();
throw e;
}
return descr;
} |
922437_4 | public DaoActor getAuthor() {
return asTeam == null ? member : asTeam;
} |
922437_5 | public static DaoFeature
createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) {
final Session session = SessionManager.getSessionFactory().getCurrentSession();
final DaoFeature feature = new DaoFeature(member, team, description, software);
try {
session.save(feature);
} catch (final HibernateException e) {
session.getTransaction().rollback();
SessionManager.getSessionFactory().getCurrentSession().beginTransaction();
throw e;
}
DaoEvent.createFeatureEvent(feature, EventType.CREATE_FEATURE);
return feature;
} |
922437_6 | public static DaoFeature
createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) {
final Session session = SessionManager.getSessionFactory().getCurrentSession();
final DaoFeature feature = new DaoFeature(member, team, description, software);
try {
session.save(feature);
} catch (final HibernateException e) {
session.getTransaction().rollback();
SessionManager.getSessionFactory().getCurrentSession().beginTransaction();
throw e;
}
DaoEvent.createFeatureEvent(feature, EventType.CREATE_FEATURE);
return feature;
} |
922437_7 | public DaoContribution addContribution(final DaoMember member, final DaoTeam team, final BigDecimal amount, final String comment)
throws NotEnoughMoneyException {
if (amount == null) {
throw new NonOptionalParameterException();
}
if (amount.compareTo(BigDecimal.ZERO) <= 0) {
Log.data().fatal("Cannot create a contribution with this amount " + amount.toEngineeringString() + " by member " + member.getId());
throw new BadProgrammerException("The amount of a contribution cannot be <= 0.", null);
}
if (comment != null && comment.length() > DaoContribution.COMMENT_MAX_LENGTH) {
Log.data().fatal("The comment of a contribution must be <= 140 chars long.");
throw new BadProgrammerException("Comments length of Contribution must be < 140.", null);
}
if (team != null && !team.getUserTeamRight(member).contains(UserTeamRight.BANK)) {
throw new BadProgrammerException("This member cannot contribute as a team.");
}
final DaoContribution newContribution = new DaoContribution(member, team, this, amount, comment);
this.contributions.add(newContribution);
this.contribution = this.contribution.add(amount);
// DaoEvent.createContributionEvent(this, EventType.ADD_CONTRIBUTION,
// newContribution);
return newContribution;
} |
922437_8 | public void addOffer(final DaoOffer offer) {
this.offers.add(offer);
DaoEvent.createOfferEvent(this, EventType.ADD_OFFER, offer);
} |
922437_9 | @Override
public void addComment(final DaoComment comment) {
this.comments.add(comment);
} |
922501_0 | public List<Element> createWebItems(InputStream in)
{
List<Element> items = newArrayList();
DocumentFactory factory = DocumentFactory.getInstance();
try
{
if (in == null)
{
return emptyList();
}
final String content = StringUtils.join(IOUtils.readLines(in), "\n");
JSONArray root = new JSONArray(stripComments(content));
for (int x=0; x<root.length(); x++)
{
Element element = factory.createElement("scoped-web-item");
element.addAttribute("key", "item-" + x);
JSONObject item = root.getJSONObject(x);
if (!item.isNull("section"))
{
element.addAttribute("section", item.getString("section"));
}
if (!item.isNull("label"))
{
element.addElement("label").setText(item.getString("label"));
}
if (hasLink(item))
{
Element link = element.addElement("link");
link.setText(getLink(item));
if (!item.isNull("cssId"))
{
link.addAttribute("linkId", item.getString("cssId"));
}
}
if (!item.isNull("cssName"))
{
element.addElement("styleClass").setText(item.getString("cssName"));
}
if (!item.isNull("weight"))
{
element.addAttribute("weight", item.getString("weight"));
}
if (!item.isNull("tooltip"))
{
element.addElement("tooltip").setText(item.getString("tooltip"));
}
if (!item.isNull("icon"))
{
JSONObject iconJson = item.getJSONObject("icon");
Element iconE = element.addElement("icon");
if (!iconJson.isNull("width"))
{
iconE.addAttribute("width", iconJson.getString("width"));
}
if (!iconJson.isNull("height"))
{
iconE.addAttribute("height", iconJson.getString("height"));
}
if (hasLink(iconJson))
{
iconE.addElement("link").setText(getLink(iconJson));
}
}
items.add(element);
}
}
catch (IOException e)
{
throw new PluginOperationFailedException("Unable to read ui/web-items.json", e, null);
}
catch (JSONException e)
{
throw new PluginOperationFailedException("Unable to parse ui/web-items.json: " + e.getMessage(), e, null);
}
finally
{
IOUtils.closeQuietly(in);
}
return items;
} |
922501_1 | public List<Element> createWebItems(InputStream in)
{
List<Element> items = newArrayList();
DocumentFactory factory = DocumentFactory.getInstance();
try
{
if (in == null)
{
return emptyList();
}
final String content = StringUtils.join(IOUtils.readLines(in), "\n");
JSONArray root = new JSONArray(stripComments(content));
for (int x=0; x<root.length(); x++)
{
Element element = factory.createElement("scoped-web-item");
element.addAttribute("key", "item-" + x);
JSONObject item = root.getJSONObject(x);
if (!item.isNull("section"))
{
element.addAttribute("section", item.getString("section"));
}
if (!item.isNull("label"))
{
element.addElement("label").setText(item.getString("label"));
}
if (hasLink(item))
{
Element link = element.addElement("link");
link.setText(getLink(item));
if (!item.isNull("cssId"))
{
link.addAttribute("linkId", item.getString("cssId"));
}
}
if (!item.isNull("cssName"))
{
element.addElement("styleClass").setText(item.getString("cssName"));
}
if (!item.isNull("weight"))
{
element.addAttribute("weight", item.getString("weight"));
}
if (!item.isNull("tooltip"))
{
element.addElement("tooltip").setText(item.getString("tooltip"));
}
if (!item.isNull("icon"))
{
JSONObject iconJson = item.getJSONObject("icon");
Element iconE = element.addElement("icon");
if (!iconJson.isNull("width"))
{
iconE.addAttribute("width", iconJson.getString("width"));
}
if (!iconJson.isNull("height"))
{
iconE.addAttribute("height", iconJson.getString("height"));
}
if (hasLink(iconJson))
{
iconE.addElement("link").setText(getLink(iconJson));
}
}
items.add(element);
}
}
catch (IOException e)
{
throw new PluginOperationFailedException("Unable to read ui/web-items.json", e, null);
}
catch (JSONException e)
{
throw new PluginOperationFailedException("Unable to parse ui/web-items.json: " + e.getMessage(), e, null);
}
finally
{
IOUtils.closeQuietly(in);
}
return items;
} |
922501_2 | public static String extractFromFilename(String fileName)
{
String name = stripExtension(fileName);
Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name);
if (m.matches())
{
return m.group(1);
}
else
{
m = UPLOADED_FILENAME_WITH_VERSION.matcher(name);
if (m.matches())
{
return m.group(1);
}
}
return name;
} |
922501_3 | public static String extractFromFilename(String fileName)
{
String name = stripExtension(fileName);
Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name);
if (m.matches())
{
return m.group(1);
}
else
{
m = UPLOADED_FILENAME_WITH_VERSION.matcher(name);
if (m.matches())
{
return m.group(1);
}
}
return name;
} |
922501_4 | public static List<String> getEntries(File root)
{
return walk(root.toURI(), root);
} |
922501_5 | static String stripStars(String jsDoc)
{
String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : "";
String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll("");
return result.trim();
} |
922501_6 | static String stripStars(String jsDoc)
{
String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : "";
String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll("");
return result.trim();
} |
922501_7 | static String stripStars(String jsDoc)
{
String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : "";
String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll("");
return result.trim();
} |
922501_8 | static String stripStars(String jsDoc)
{
String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : "";
String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll("");
return result.trim();
} |
922501_9 | static Map<String,String> extractAttributes(String jsDocWithNoStars)
{
return null;
} |
927454_0 | static void publishMessagesIndividually() throws Exception {
try (Connection connection = createConnection()) {
Channel ch = connection.createChannel();
String queue = UUID.randomUUID().toString();
ch.queueDeclare(queue, false, false, true, null);
ch.confirmSelect();
long start = System.nanoTime();
for (int i = 0; i < MESSAGE_COUNT; i++) {
String body = String.valueOf(i);
ch.basicPublish("", queue, null, body.getBytes());
ch.waitForConfirmsOrDie(5_000);
}
long end = System.nanoTime();
System.out.format("Published %,d messages individually in %,d ms%n", MESSAGE_COUNT, Duration.ofNanos(end - start).toMillis());
}
} |
927454_1 | static void publishMessagesInBatch() throws Exception {
try (Connection connection = createConnection()) {
Channel ch = connection.createChannel();
String queue = UUID.randomUUID().toString();
ch.queueDeclare(queue, false, false, true, null);
ch.confirmSelect();
int batchSize = 100;
int outstandingMessageCount = 0;
long start = System.nanoTime();
for (int i = 0; i < MESSAGE_COUNT; i++) {
String body = String.valueOf(i);
ch.basicPublish("", queue, null, body.getBytes());
outstandingMessageCount++;
if (outstandingMessageCount == batchSize) {
ch.waitForConfirmsOrDie(5_000);
outstandingMessageCount = 0;
}
}
if (outstandingMessageCount > 0) {
ch.waitForConfirmsOrDie(5_000);
}
long end = System.nanoTime();
System.out.format("Published %,d messages in batch in %,d ms%n", MESSAGE_COUNT, Duration.ofNanos(end - start).toMillis());
}
} |
927454_2 | static boolean waitUntil(Duration timeout, BooleanSupplier condition) throws InterruptedException {
int waited = 0;
while (!condition.getAsBoolean() && waited < timeout.toMillis()) {
Thread.sleep(100L);
waited = +100;
}
return condition.getAsBoolean();
} |
927454_3 | static boolean waitUntil(Duration timeout, BooleanSupplier condition) throws InterruptedException {
int waited = 0;
while (!condition.getAsBoolean() && waited < timeout.toMillis()) {
Thread.sleep(100L);
waited = +100;
}
return condition.getAsBoolean();
} |
927454_4 | static boolean waitUntil(Duration timeout, BooleanSupplier condition) throws InterruptedException {
int waited = 0;
while (!condition.getAsBoolean() && waited < timeout.toMillis()) {
Thread.sleep(100L);
waited = +100;
}
return condition.getAsBoolean();
} |
936063_0 | @Override
protected void execute() throws ArchiverException, IOException {
File dest = getDestFile();
if (dest == null) {
throw new Iso9660ArchiverException(
Iso9660ArchiverException.Type.MissingDestination,
"You must set the destination " + getArchiveType()
+ " file.");
}
if (dest.exists() && !dest.isFile()) {
throw new Iso9660ArchiverException(
Iso9660ArchiverException.Type.DestinationNotAFile, dest
+ " isn't a file.");
}
if (dest.exists() && !dest.canWrite()) {
throw new Iso9660ArchiverException(
Iso9660ArchiverException.Type.DestinationReadOnly, dest
+ " is read-only.");
}
ISO9660RootDirectory.MOVED_DIRECTORIES_STORE_NAME = "rr_moved";
ISO9660RootDirectory root = new ISO9660RootDirectory();
try {
Map<String, ISO9660Directory> directories = new TreeMap<String, ISO9660Directory>();
Map<String, ISO9660File> files = new TreeMap<String, ISO9660File>();
/* Prepare a map of all paths to ISO objects and create all intermediate objects */
directories.put("", root);
for (ResourceIterator i = getResources(); i.hasNext();) {
ArchiveEntry entry = i.next();
switch (entry.getType()) {
case ArchiveEntry.DIRECTORY: {
ISO9660Directory dir;
dir = new ISO9660Directory(getName(entry));
directories.put(getPath(entry), dir);
String path = getPath(entry);
while ((path = getParentPath(path)) != "") {
dir = new ISO9660Directory(getName(path));
directories.put(path, dir);
}
break;
}
case ArchiveEntry.FILE: {
ISO9660File file;
ISO9660Directory dir;
/* Create the file */
file = new ISO9660File(
new ArchiveEntryDataReference(entry),
getName(entry), entry.getResource()
.getLastModified());
files.put(getPath(entry), file);
String path = getPath(entry);
while ((path = getParentPath(path)) != "") {
dir = new ISO9660Directory(getName(path));
directories.put(path, dir);
}
break;
}
default:
throw new Iso9660ArchiverException(
Type.UnsupportedEntryType, "Unknown entry type");
}
}
/* Attache children to their parents */
for (Map.Entry<String, ISO9660Directory> e : directories.entrySet()) {
if (!e.getKey().equals("")) {
ISO9660Directory parent = directories.get(getParentPath(e
.getKey()));
parent.addDirectory(e.getValue());
}
}
for (Map.Entry<String, ISO9660File> e : files.entrySet()) {
ISO9660Directory parent = directories.get(getParentPath(e
.getKey()));
parent.addFile(e.getValue());
}
StreamHandler streamHandler = new ISOImageFileHandler(new File(
dest.getParentFile(), dest.getName()));
CreateISO iso = new CreateISO(streamHandler, root);
ISO9660Config iso9660Config = new ISO9660Config();
iso9660Config.allowASCII(false);
iso9660Config.setInterchangeLevel(1);
iso9660Config.restrictDirDepthTo8(true);
iso9660Config.forceDotDelimiter(true);
applyConfig(iso9660Config);
RockRidgeConfig rrConfig = new RockRidgeConfig();
rrConfig.setMkisofsCompatibility(false);
rrConfig.hideMovedDirectoriesStore(true);
rrConfig.forcePortableFilenameCharacterSet(true);
JolietConfig jolietConfig = new JolietConfig();
jolietConfig.forceDotDelimiter(true);
applyConfig(jolietConfig);
iso.process(iso9660Config, rrConfig, jolietConfig, null);
} catch (HandlerException e) {
throw new ArchiverException(e.getMessage(), e);
} catch (FileNotFoundException e) {
throw new ArchiverException(e.getMessage(), e);
} catch (ConfigException e) {
throw new ArchiverException(e.getMessage(), e);
}
} |
936063_1 | @Override
protected String getArchiveType() {
return "iso9660";
} |
936063_2 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
936063_3 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
936063_4 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
936063_5 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
936063_6 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
936063_7 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
936063_8 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
936063_9 | public void process(ISO9660Config iso9660Config, RockRidgeConfig rrConfig, JolietConfig jolietConfig,
ElToritoConfig elToritoConfig) throws HandlerException {
if (iso9660Config == null) {
throw new NullPointerException("Cannot create ISO without ISO9660Config.");
}
((LogicalSectorPaddingHandler) streamHandler).setPadEnd(iso9660Config.getPadEnd());
// Last handler added processes data first
if (jolietConfig != null) {
streamHandler = new JolietHandler(streamHandler, root, jolietConfig);
}
if (elToritoConfig != null) {
streamHandler = new ElToritoHandler(streamHandler, elToritoConfig);
}
streamHandler = new ISO9660Handler(streamHandler, root, iso9660Config, rrConfig);
streamHandler = new FileHandler(streamHandler, root);
streamHandler.startDocument();
// System Area
streamHandler.startElement(new ISO9660Element("SA"));
streamHandler.endElement();
// Volume Descriptor Set
streamHandler.startElement(new ISO9660Element("VDS"));
streamHandler.endElement();
// Boot Info Area
streamHandler.startElement(new ISO9660Element("BIA"));
streamHandler.endElement();
// Path Table Area
streamHandler.startElement(new ISO9660Element("PTA"));
streamHandler.endElement();
// Directory Records Area
streamHandler.startElement(new ISO9660Element("DRA"));
streamHandler.endElement();
// Boot Data Area
streamHandler.startElement(new ISO9660Element("BDA"));
streamHandler.endElement();
// File Contents Area
streamHandler.startElement(new ISO9660Element("FCA"));
streamHandler.endElement();
streamHandler.endDocument();
} |
940337_0 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_1 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_2 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_3 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_4 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_5 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_6 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_7 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_8 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
940337_9 | static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
//path from one to the other, so just return the canonical file
if (!basePath.get(0).equals(pathToRelativize.get(0))) {
return canonicalFileToRelativize.getPath();
}
int commonDirs;
StringBuilder sb = new StringBuilder();
for (commonDirs=1; commonDirs<basePath.size() && commonDirs<pathToRelativize.size(); commonDirs++) {
if (!basePath.get(commonDirs).equals(pathToRelativize.get(commonDirs))) {
break;
}
}
boolean first = true;
for (int i=commonDirs; i<basePath.size(); i++) {
if (!first) {
sb.append(File.separatorChar);
} else {
first = false;
}
sb.append("..");
}
first = true;
for (int i=commonDirs; i<pathToRelativize.size(); i++) {
if (first) {
if (sb.length() != 0) {
sb.append(File.separatorChar);
}
first = false;
} else {
sb.append(File.separatorChar);
}
sb.append(pathToRelativize.get(i));
}
if (sb.length() == 0) {
return ".";
}
return sb.toString();
} |
944926_0 | public boolean hasFlag(char ch) {
return booleanFlags.contains(ch) || valueFlags.containsKey(ch);
} |
944926_1 | public String[] getSlice(int index) {
String[] slice = new String[originalArgs.length - index];
System.arraycopy(originalArgs, index, slice, 0, originalArgs.length - index);
return slice;
} |
944926_2 | public int argsLength() {
return parsedArgs.size();
} |
944926_3 | public Extent getExtent() {
return extent;
} |
944926_4 | public Vector3 toVector() {
return position;
} |
944926_5 | public double getX() {
return position.getX();
} |
944926_6 | public int getBlockX() {
return (int) Math.floor(position.getX());
} |
944926_7 | public Location setX(double x) {
return new Location(extent, position.withX(x), yaw, pitch);
} |
944926_8 | public double getY() {
return position.getY();
} |
944926_9 | public int getBlockY() {
return (int) Math.floor(position.getY());
} |
947990_0 | @Override
public boolean isValid(Asociado asociado, ConstraintValidatorContext context) {
if (asociado == null || asociado.getFechaNacimiento() == null)
return true;
context.disableDefaultConstraintViolation();
if (Strings.isNullOrEmpty(asociado.getDni()))
{
boolean mayorDeEdad = asociado.getFechaNacimiento().plus(18, ChronoUnit.YEARS).isBefore(LocalDate.now());
if (mayorDeEdad) {
context.buildConstraintViolationWithTemplate(MSG_REQUERIDO_MAYOR_EDAD).addConstraintViolation();
return false;
} else {
return true;
}
}
return validarDniNie(asociado.getDni(), context);
} |
947990_1 | @Override
public boolean isValid(Asociado asociado, ConstraintValidatorContext context) {
if (asociado == null || asociado.getFechaNacimiento() == null)
return true;
context.disableDefaultConstraintViolation();
if (Strings.isNullOrEmpty(asociado.getDni()))
{
boolean mayorDeEdad = asociado.getFechaNacimiento().plus(18, ChronoUnit.YEARS).isBefore(LocalDate.now());
if (mayorDeEdad) {
context.buildConstraintViolationWithTemplate(MSG_REQUERIDO_MAYOR_EDAD).addConstraintViolation();
return false;
} else {
return true;
}
}
return validarDniNie(asociado.getDni(), context);
} |
947990_2 | @Override
public boolean isValid(Asociado asociado, ConstraintValidatorContext context) {
if (asociado == null || asociado.getFechaNacimiento() == null)
return true;
context.disableDefaultConstraintViolation();
if (Strings.isNullOrEmpty(asociado.getDni()))
{
boolean mayorDeEdad = asociado.getFechaNacimiento().plus(18, ChronoUnit.YEARS).isBefore(LocalDate.now());
if (mayorDeEdad) {
context.buildConstraintViolationWithTemplate(MSG_REQUERIDO_MAYOR_EDAD).addConstraintViolation();
return false;
} else {
return true;
}
}
return validarDniNie(asociado.getDni(), context);
} |
952585_0 | public ResponseEntity<?> handleKillThreadPost(Map<String, String> form, TileLayer tl) {
String id = form.get("thread_id");
StringBuilder doc = new StringBuilder();
makeHeader(doc);
if (seeder.terminateGWCTask(Long.parseLong(id))) {
doc.append("<ul><li>Requested to terminate task " + id + ".</li></ul>");
} else {
doc.append(
"<ul><li>Sorry, either task "
+ id
+ " has not started yet, or it is a truncate task that cannot be interrutped.</li></ul>");
}
if (tl != null) {
doc.append("<p><a href=\"./" + tl.getName() + "\">Go back</a></p>\n");
}
return new ResponseEntity<Object>(doc.toString(), getHeaders(), HttpStatus.OK);
} |
952585_1 | @Override
public XStream getConfiguredXStream(XStream xs) {
Class<AzureBlobStoreInfo> clazz = AzureBlobStoreInfo.class;
xs.alias("AzureBlobStore", clazz);
xs.aliasField("id", clazz, "name");
return xs;
} |
952585_2 | String generateGetCapabilities(Charset encoding) {
StringBuilder str = new StringBuilder();
XMLBuilder xml = new XMLBuilder(str);
try {
xml.header("1.0", encoding);
xml.appendUnescaped(
"<!DOCTYPE WMT_MS_Capabilities SYSTEM \"http://schemas.opengis.net/wms/1.1.1/capabilities_1_1_1.dtd\" ");
if (includeVendorSpecific) {
xml.appendUnescaped("[\n");
xml.appendUnescaped("<!ELEMENT VendorSpecificCapabilities (TileSet*) >\n");
xml.appendUnescaped(
"<!ELEMENT TileSet (SRS, BoundingBox?, Resolutions, Width, Height, Format, Layers*, Styles*) >\n");
xml.appendUnescaped("<!ELEMENT Resolutions (#PCDATA) >\n");
xml.appendUnescaped("<!ELEMENT Width (#PCDATA) >\n");
xml.appendUnescaped("<!ELEMENT Height (#PCDATA) >\n");
xml.appendUnescaped("<!ELEMENT Layers (#PCDATA) >\n");
xml.appendUnescaped("<!ELEMENT Styles (#PCDATA) >\n");
xml.appendUnescaped("]");
}
xml.appendUnescaped(">\n");
xml.indentElement("WMT_MS_Capabilities").attribute("version", "1.1.1");
// The actual meat
service(xml);
capability(xml);
xml.endElement();
} catch (IOException e) {
// Should not happen as StringBuilder doesn't throw IOException
throw new IllegalStateException(e);
}
return str.toString();
} |
952585_3 | @Override
public ConveyorTile getConveyor(HttpServletRequest request, HttpServletResponse response)
throws GeoWebCacheException {
final String encoding = request.getCharacterEncoding();
final Map requestParameterMap = request.getParameterMap();
String[] keys = {"layers", "request", "tiled", "cached", "metatiled", "width", "height"};
Map<String, String> values =
ServletUtils.selectedStringsFromMap(requestParameterMap, encoding, keys);
// Look for layer
String layers = values.get("layers");
// Get the TileLayer
TileLayer tileLayer = null;
if (layers != null) {
tileLayer = tld.getTileLayer(layers);
}
// Look for requests that are not getmap
String req = values.get("request");
if (req != null && !req.equalsIgnoreCase("getmap")) {
// If no LAYERS specified, try using LAYER.
if (layers == null || layers.length() == 0) {
layers = ServletUtils.stringFromMap(requestParameterMap, encoding, "layer");
values.put("LAYERS", layers);
if (layers != null) {
tileLayer = tld.getTileLayer(layers);
}
}
Map<String, String> filteringParameters = null;
// If tileLayer is not null, then request parameters are extracted from it-
if (tileLayer != null) {
filteringParameters =
tileLayer.getModifiableParameters(requestParameterMap, encoding);
}
// Creation of a Conveyor Tile with a fake Image/png format and the associated
// parameters.
ConveyorTile tile =
new ConveyorTile(
sb,
layers,
null,
null,
ImageMime.png,
filteringParameters,
request,
response);
tile.setHint(req.toLowerCase());
tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
return tile;
}
if (layers == null) {
throw new ServiceException("Unable to parse layers parameter from request.");
}
// Check whether this request is missing tiled=true
final boolean tiled = Boolean.valueOf(values.get("tiled"));
if (proxyNonTiledRequests && tiled) {
ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
tile.setHint(req);
tile.setRequestHandler(Conveyor.RequestHandler.SERVICE);
return tile;
}
String[] paramKeys = {"format", "srs", "bbox"};
final Map<String, String> paramValues =
ServletUtils.selectedStringsFromMap(requestParameterMap, encoding, paramKeys);
final Map<String, String> fullParameters =
tileLayer.getModifiableParameters(requestParameterMap, encoding);
final MimeType mimeType;
String format = paramValues.get("format");
try {
mimeType = MimeType.createFromFormat(format);
} catch (MimeException me) {
throw new ServiceException("Unable to determine requested format, " + format);
}
final SRS srs;
{
String requestSrs = paramValues.get("srs");
if (requestSrs == null) {
throw new ServiceException("No SRS specified");
}
srs = SRS.getSRS(requestSrs);
}
final BoundingBox bbox;
{
String requestBbox = paramValues.get("bbox");
try {
bbox = new BoundingBox(requestBbox);
if (bbox == null || !bbox.isSane()) {
throw new ServiceException(
"The bounding box parameter ("
+ requestBbox
+ ") is missing or not sane");
}
} catch (NumberFormatException nfe) {
throw new ServiceException(
"The bounding box parameter (" + requestBbox + ") is invalid");
}
}
final int tileWidth = Integer.parseInt(values.get("width"));
final int tileHeight = Integer.parseInt(values.get("height"));
final List<GridSubset> crsMatchingSubsets = tileLayer.getGridSubsetsForSRS(srs);
if (crsMatchingSubsets.isEmpty()) {
throw new ServiceException(
"Unable to match requested SRS " + srs + " to those supported by layer");
}
long[] tileIndexTarget = new long[3];
GridSubset gridSubset;
{
GridSubset bestMatch =
findBestMatchingGrid(
bbox, crsMatchingSubsets, tileWidth, tileHeight, tileIndexTarget);
if (bestMatch == null) {
// proceed as it used to be
gridSubset = crsMatchingSubsets.get(0);
tileIndexTarget = null;
} else {
gridSubset = bestMatch;
}
}
if (fullWMS) {
// If we support full WMS we need to do a few tests to determine whether
// this is a request that requires us to recombine tiles to respond.
long[] tileIndex = null;
if (tileIndexTarget == null) {
try {
tileIndex = gridSubset.closestIndex(bbox);
} catch (GridMismatchException gme) {
// Do nothing, the null is info enough
}
} else {
tileIndex = tileIndexTarget;
}
if (tileIndex == null
|| gridSubset.getTileWidth() != tileWidth
|| gridSubset.getTileHeight() != tileHeight
|| !bbox.equals(gridSubset.boundsFromIndex(tileIndex), 0.02)) {
log.debug("Recombinining tiles to respond to WMS request");
ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
tile.setHint("getmap");
tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
return tile;
}
}
long[] tileIndex =
tileIndexTarget == null ? gridSubset.closestIndex(bbox) : tileIndexTarget;
gridSubset.checkTileDimensions(tileWidth, tileHeight);
return new ConveyorTile(
sb,
layers,
gridSubset.getName(),
tileIndex,
mimeType,
fullParameters,
request,
response);
} |
952585_4 | @Override
public ConveyorTile getConveyor(HttpServletRequest request, HttpServletResponse response)
throws GeoWebCacheException {
final String encoding = request.getCharacterEncoding();
final Map requestParameterMap = request.getParameterMap();
String[] keys = {"layers", "request", "tiled", "cached", "metatiled", "width", "height"};
Map<String, String> values =
ServletUtils.selectedStringsFromMap(requestParameterMap, encoding, keys);
// Look for layer
String layers = values.get("layers");
// Get the TileLayer
TileLayer tileLayer = null;
if (layers != null) {
tileLayer = tld.getTileLayer(layers);
}
// Look for requests that are not getmap
String req = values.get("request");
if (req != null && !req.equalsIgnoreCase("getmap")) {
// If no LAYERS specified, try using LAYER.
if (layers == null || layers.length() == 0) {
layers = ServletUtils.stringFromMap(requestParameterMap, encoding, "layer");
values.put("LAYERS", layers);
if (layers != null) {
tileLayer = tld.getTileLayer(layers);
}
}
Map<String, String> filteringParameters = null;
// If tileLayer is not null, then request parameters are extracted from it-
if (tileLayer != null) {
filteringParameters =
tileLayer.getModifiableParameters(requestParameterMap, encoding);
}
// Creation of a Conveyor Tile with a fake Image/png format and the associated
// parameters.
ConveyorTile tile =
new ConveyorTile(
sb,
layers,
null,
null,
ImageMime.png,
filteringParameters,
request,
response);
tile.setHint(req.toLowerCase());
tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
return tile;
}
if (layers == null) {
throw new ServiceException("Unable to parse layers parameter from request.");
}
// Check whether this request is missing tiled=true
final boolean tiled = Boolean.valueOf(values.get("tiled"));
if (proxyNonTiledRequests && tiled) {
ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
tile.setHint(req);
tile.setRequestHandler(Conveyor.RequestHandler.SERVICE);
return tile;
}
String[] paramKeys = {"format", "srs", "bbox"};
final Map<String, String> paramValues =
ServletUtils.selectedStringsFromMap(requestParameterMap, encoding, paramKeys);
final Map<String, String> fullParameters =
tileLayer.getModifiableParameters(requestParameterMap, encoding);
final MimeType mimeType;
String format = paramValues.get("format");
try {
mimeType = MimeType.createFromFormat(format);
} catch (MimeException me) {
throw new ServiceException("Unable to determine requested format, " + format);
}
final SRS srs;
{
String requestSrs = paramValues.get("srs");
if (requestSrs == null) {
throw new ServiceException("No SRS specified");
}
srs = SRS.getSRS(requestSrs);
}
final BoundingBox bbox;
{
String requestBbox = paramValues.get("bbox");
try {
bbox = new BoundingBox(requestBbox);
if (bbox == null || !bbox.isSane()) {
throw new ServiceException(
"The bounding box parameter ("
+ requestBbox
+ ") is missing or not sane");
}
} catch (NumberFormatException nfe) {
throw new ServiceException(
"The bounding box parameter (" + requestBbox + ") is invalid");
}
}
final int tileWidth = Integer.parseInt(values.get("width"));
final int tileHeight = Integer.parseInt(values.get("height"));
final List<GridSubset> crsMatchingSubsets = tileLayer.getGridSubsetsForSRS(srs);
if (crsMatchingSubsets.isEmpty()) {
throw new ServiceException(
"Unable to match requested SRS " + srs + " to those supported by layer");
}
long[] tileIndexTarget = new long[3];
GridSubset gridSubset;
{
GridSubset bestMatch =
findBestMatchingGrid(
bbox, crsMatchingSubsets, tileWidth, tileHeight, tileIndexTarget);
if (bestMatch == null) {
// proceed as it used to be
gridSubset = crsMatchingSubsets.get(0);
tileIndexTarget = null;
} else {
gridSubset = bestMatch;
}
}
if (fullWMS) {
// If we support full WMS we need to do a few tests to determine whether
// this is a request that requires us to recombine tiles to respond.
long[] tileIndex = null;
if (tileIndexTarget == null) {
try {
tileIndex = gridSubset.closestIndex(bbox);
} catch (GridMismatchException gme) {
// Do nothing, the null is info enough
}
} else {
tileIndex = tileIndexTarget;
}
if (tileIndex == null
|| gridSubset.getTileWidth() != tileWidth
|| gridSubset.getTileHeight() != tileHeight
|| !bbox.equals(gridSubset.boundsFromIndex(tileIndex), 0.02)) {
log.debug("Recombinining tiles to respond to WMS request");
ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
tile.setHint("getmap");
tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
return tile;
}
}
long[] tileIndex =
tileIndexTarget == null ? gridSubset.closestIndex(bbox) : tileIndexTarget;
gridSubset.checkTileDimensions(tileWidth, tileHeight);
return new ConveyorTile(
sb,
layers,
gridSubset.getName(),
tileIndex,
mimeType,
fullParameters,
request,
response);
} |
952585_5 | @Override
public ConveyorTile getConveyor(HttpServletRequest request, HttpServletResponse response)
throws GeoWebCacheException {
final String encoding = request.getCharacterEncoding();
final Map requestParameterMap = request.getParameterMap();
String[] keys = {"layers", "request", "tiled", "cached", "metatiled", "width", "height"};
Map<String, String> values =
ServletUtils.selectedStringsFromMap(requestParameterMap, encoding, keys);
// Look for layer
String layers = values.get("layers");
// Get the TileLayer
TileLayer tileLayer = null;
if (layers != null) {
tileLayer = tld.getTileLayer(layers);
}
// Look for requests that are not getmap
String req = values.get("request");
if (req != null && !req.equalsIgnoreCase("getmap")) {
// If no LAYERS specified, try using LAYER.
if (layers == null || layers.length() == 0) {
layers = ServletUtils.stringFromMap(requestParameterMap, encoding, "layer");
values.put("LAYERS", layers);
if (layers != null) {
tileLayer = tld.getTileLayer(layers);
}
}
Map<String, String> filteringParameters = null;
// If tileLayer is not null, then request parameters are extracted from it-
if (tileLayer != null) {
filteringParameters =
tileLayer.getModifiableParameters(requestParameterMap, encoding);
}
// Creation of a Conveyor Tile with a fake Image/png format and the associated
// parameters.
ConveyorTile tile =
new ConveyorTile(
sb,
layers,
null,
null,
ImageMime.png,
filteringParameters,
request,
response);
tile.setHint(req.toLowerCase());
tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
return tile;
}
if (layers == null) {
throw new ServiceException("Unable to parse layers parameter from request.");
}
// Check whether this request is missing tiled=true
final boolean tiled = Boolean.valueOf(values.get("tiled"));
if (proxyNonTiledRequests && tiled) {
ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
tile.setHint(req);
tile.setRequestHandler(Conveyor.RequestHandler.SERVICE);
return tile;
}
String[] paramKeys = {"format", "srs", "bbox"};
final Map<String, String> paramValues =
ServletUtils.selectedStringsFromMap(requestParameterMap, encoding, paramKeys);
final Map<String, String> fullParameters =
tileLayer.getModifiableParameters(requestParameterMap, encoding);
final MimeType mimeType;
String format = paramValues.get("format");
try {
mimeType = MimeType.createFromFormat(format);
} catch (MimeException me) {
throw new ServiceException("Unable to determine requested format, " + format);
}
final SRS srs;
{
String requestSrs = paramValues.get("srs");
if (requestSrs == null) {
throw new ServiceException("No SRS specified");
}
srs = SRS.getSRS(requestSrs);
}
final BoundingBox bbox;
{
String requestBbox = paramValues.get("bbox");
try {
bbox = new BoundingBox(requestBbox);
if (bbox == null || !bbox.isSane()) {
throw new ServiceException(
"The bounding box parameter ("
+ requestBbox
+ ") is missing or not sane");
}
} catch (NumberFormatException nfe) {
throw new ServiceException(
"The bounding box parameter (" + requestBbox + ") is invalid");
}
}
final int tileWidth = Integer.parseInt(values.get("width"));
final int tileHeight = Integer.parseInt(values.get("height"));
final List<GridSubset> crsMatchingSubsets = tileLayer.getGridSubsetsForSRS(srs);
if (crsMatchingSubsets.isEmpty()) {
throw new ServiceException(
"Unable to match requested SRS " + srs + " to those supported by layer");
}
long[] tileIndexTarget = new long[3];
GridSubset gridSubset;
{
GridSubset bestMatch =
findBestMatchingGrid(
bbox, crsMatchingSubsets, tileWidth, tileHeight, tileIndexTarget);
if (bestMatch == null) {
// proceed as it used to be
gridSubset = crsMatchingSubsets.get(0);
tileIndexTarget = null;
} else {
gridSubset = bestMatch;
}
}
if (fullWMS) {
// If we support full WMS we need to do a few tests to determine whether
// this is a request that requires us to recombine tiles to respond.
long[] tileIndex = null;
if (tileIndexTarget == null) {
try {
tileIndex = gridSubset.closestIndex(bbox);
} catch (GridMismatchException gme) {
// Do nothing, the null is info enough
}
} else {
tileIndex = tileIndexTarget;
}
if (tileIndex == null
|| gridSubset.getTileWidth() != tileWidth
|| gridSubset.getTileHeight() != tileHeight
|| !bbox.equals(gridSubset.boundsFromIndex(tileIndex), 0.02)) {
log.debug("Recombinining tiles to respond to WMS request");
ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
tile.setHint("getmap");
tile.setRequestHandler(ConveyorTile.RequestHandler.SERVICE);
return tile;
}
}
long[] tileIndex =
tileIndexTarget == null ? gridSubset.closestIndex(bbox) : tileIndexTarget;
gridSubset.checkTileDimensions(tileWidth, tileHeight);
return new ConveyorTile(
sb,
layers,
gridSubset.getName(),
tileIndex,
mimeType,
fullParameters,
request,
response);
} |
952585_6 | public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) {
this.securityDispatcher = securityDispatcher;
} |
952585_7 | public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) {
this.securityDispatcher = securityDispatcher;
} |
952585_8 | public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) {
this.securityDispatcher = securityDispatcher;
} |
952585_9 | public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) {
this.securityDispatcher = securityDispatcher;
} |
960343_0 | public static ITabularFormula createRandomFormula(Random random, int varCount, int clausesCount)
{
int mMax = getMaxNumberOfUniqueTriplets(varCount);
if (clausesCount > mMax) {
throw new IllegalArgumentException(MessageFormat
.format("3-SAT formula of {0} variables may have at most {1} valuable clauses, but requested to create formula with " + clausesCount + " clauses",
varCount, mMax));
}
ITabularFormula formula = new SimpleFormula();
for (int i = 0; i < clausesCount && formula.getPermutation().size() < varCount; i++)
{
formula.add(createRandomTriplet(random, varCount));
}
return formula;
} |
960343_1 | public static void unify(ObjectArrayList cts) throws EmptyStructureException
{
if (cts.size() < 2)
{
throw new IllegalArgumentException("Unification is a q-ary operation where q should be > 1");
}
VarPairsIndex index = VarPairsIndexFactory.getInstance().buildIndex(cts);
unify(index, ((ICompactTripletsStructureHolder) cts.get(0)).getCTS().getPermutation(), cts, 1);
} |
960343_2 | public static int getCanonicalVarName3(int varName1, int varName2, int[] canonicalName)
{
int varName3;
if (varName1 == canonicalName[1])
{
if (varName2 == canonicalName[2])
{
varName3 = canonicalName[0];
} else
{
varName3 = canonicalName[2];
}
}
else
{
if (varName2 == canonicalName[1])
{
if (varName1 > varName2)
{
varName3 = canonicalName[0];
}
else
{
varName3 = canonicalName[2];
}
}
else
{
varName3 = canonicalName[1];
}
}
return varName3;
} |
960343_3 | public static ObjectArrayList createCTF(ITabularFormula formula)
{
ObjectArrayList ctf = new ObjectArrayList();
ObjectArrayList tiers = formula.getTiers();
ITabularFormula f = new SimpleFormula();
f.unionOrAdd(formula.getTier(0).clone());
ctf.add(f);
for (int i = 1; i < tiers.size(); i++)
{
ITier tier = ((ITier) tiers.get(i)).clone();
// Search possible CTFs to which the tier may join
if (!joinTier(ctf, tier))
{
f = new SimpleFormula();
f.unionOrAdd(tier);
ctf.add(f);
}
}
return ctf;
} |
960343_4 | public static void convertCTStructuresToRomanovSKTFileFormat(ObjectArrayList cts, String filename)
throws FileNotFoundException, IOException
{
OutputStream os = null;
try
{
os = new FileOutputStream(new File(filename));
for (int i = 0; i < cts.size(); i++)
{
ITabularFormula f = (ITabularFormula) cts.get(i);
for (int j = 0; j < f.getTiers().size(); j++)
{
ITier tier = f.getTier(j);
for (ITripletValue tripletValue : tier)
{
int a = (tripletValue.isNotA() ? -1 : 1) * tier.getAName();
int b = (tripletValue.isNotB() ? -1 : 1) * tier.getBName();
int c = (tripletValue.isNotC() ? -1 : 1) * tier.getCName();
writeJavaIntAsDelphiLongInt(os, a);
writeJavaIntAsDelphiLongInt(os, b);
writeJavaIntAsDelphiLongInt(os, c);
}
}
writeJavaIntAsDelphiLongInt(os, 0);
writeJavaIntAsDelphiLongInt(os, 0);
writeJavaIntAsDelphiLongInt(os, 0);
}
}
finally
{
if (os != null)
{
os.close();
}
}
} |
960343_5 | public int indexOf(int varName)
{
// TODO Replacing zero-based indexing with the 1-based
// allow remove invocation of containsKey method here
// O(1)
return permutationHash.containsKey(varName)
? permutationHash.get(varName)
: -1;
} |
960343_6 | public void shiftToStart(int from, int to)
{
if (to <= from)
{
throw new IllegalArgumentException("to <= from");
}
int[] buffer = new int[from]; // Allocate single static buffer somewhere outside?
int[] elements = permutation.elements();
System.arraycopy(elements, 0, buffer, 0, from);
System.arraycopy(elements, from, elements, 0, to - from + 1);
System.arraycopy(buffer, 0, elements, to - from + 1, from);
for (int i = 0; i <= to; i++)
{
int varName = elements[i];
permutationHash.put(varName, i);
positionHash.put(i, varName);
}
elementsHashDirty = true;
} |
960343_7 | public void shiftToEnd(int from, int to)
{
if (to <= from)
{
throw new IllegalArgumentException("to <= from");
}
int[] buffer = new int[permutation.size() - to - 1]; // Allocate single static buffer somewhere outside?
int[] elements = permutation.elements();
System.arraycopy(elements, to + 1, buffer, 0, permutation.size() - to - 1);
System.arraycopy(elements, from, elements, permutation.size() - (to - from) - 1, to - from + 1);
System.arraycopy(buffer, 0, elements, from, permutation.size() - to - 1);
for (int i = from; i < permutation.size(); i++)
{
int varName = elements[i];
permutationHash.put(varName, i);
positionHash.put(i, varName);
}
elementsHashDirty = true;
} |
960343_8 | public boolean evaluate(Properties properties)
{
boolean result = true;
for (int j = 0; j < getTiers().size(); j++)
{
for (ITripletValue tiplet : getTier(j))
{
ITripletPermutation permutation = getTier(j);
boolean aValue = parseBoolean(String.valueOf(properties.get("_" + permutation.getAName())));
boolean bValue = parseBoolean(String.valueOf(properties.get("_" + permutation.getBName())));
boolean cValue = parseBoolean(String.valueOf(properties.get("_" + permutation.getCName())));
if (tiplet.isNotA()) aValue = !aValue;
if (tiplet.isNotB()) bValue = !bValue;
if (tiplet.isNotC()) cValue = !cValue;
result = result && (aValue || bValue || cValue);
if (!result)
{
return result;
}
}
}
return result;
} |
960343_9 | public void add(ITripletValue triplet)
{
if (!contains(triplet)) // We need this check to keep value of size correct
{
keys_73516240 = (byte)(keys_73516240 | triplet.getTierKey());
size++;
}
} |
960760_0 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_1 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_2 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_3 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_4 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_5 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_6 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_7 | public synchronized float addValue(final float value) {
sumBuffer += value;
if ((minBuffer == null) || (value < minBuffer)) {
minBuffer = value;
}
if ((maxBuffer == null) || (value > maxBuffer)) {
maxBuffer = value;
}
buffer[pointer++] = value;
pointer = pointer % bufferSize;
if (maxValidFieldValue < buffer.length) {
++maxValidFieldValue;
}
return getValue(defaultOperation);
} |
960760_8 | @Override
public void add(final DrawingObject d) {
if (threadSafe) {
synchronized (lock) {
if (insertionOrder.containsKey(d)) {
throw new RuntimeException("Don't do double insert, no no ;-)");
}
d.addBoundingBoxChangedListener(this);
insertionOrder.put(d, ++insertionOrderLargest);
tree.insertItem(d, d.getBoundingBox().rectangle);
}
} else {
if (insertionOrder.containsKey(d)) {
throw new RuntimeException("Don't do double insert, no no ;-)");
}
d.addBoundingBoxChangedListener(this);
insertionOrder.put(d, ++insertionOrderLargest);
tree.insertItem(d, d.getBoundingBox().rectangle);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.