1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2015-05-06 17:31:46 -07:00
parent 0f25dd18d3
commit f14b41343a
10 changed files with 44 additions and 46 deletions

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,7 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.tag;
import org.eclipse.cdt.core.dom.ast.IASTName;

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,7 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.tag;
/**

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,7 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.tag;
/**

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,7 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.tag;
import org.eclipse.cdt.core.dom.ast.IBinding;
@ -25,8 +25,7 @@ public interface ITagService {
* Finds or creates a tag reader for the specified binding or null if a reader cannot be
* associated with this binding.
*
* @param binding
* could be null
* @param binding could be null
*/
public ITagReader findTagReader(IBinding binding);
}

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,8 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.tag;
/**

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,7 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.tag;
/**
@ -21,7 +21,9 @@ package org.eclipse.cdt.core.dom.ast.tag;
* @since 5.5
*/
public interface IWritableTag extends ITag {
/** Writes the given byte to the given offset in the tag. Returns {@code true} if successful. */
/**
* Writes the given byte to the given offset in the tag. Returns {@code true} if successful.
*/
public boolean putByte(int offset, byte data);
/**

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,12 +7,12 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.tag;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
@ -42,13 +42,13 @@ public class BTreeIterable<T> implements Iterable<T> {
btree.accept(v);
} catch (CoreException e) {
CCorePlugin.log(e);
return Collections.<T> emptyList().iterator();
return Collections.<T>emptyList().iterator();
}
return new BTreeIterator(v.records);
}
private class Visitor implements IBTreeVisitor {
public final List<Long> records = new LinkedList<Long>();
public final List<Long> records = new ArrayList<>();
@Override
public int compare(long record) throws CoreException {

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,8 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.tag;
import org.eclipse.cdt.core.CCorePlugin;
@ -109,27 +108,28 @@ public class PDOMTag implements IWritableTag {
@Override
public String getTaggerId() {
if (taggerId == null)
if (taggerId == null) {
try {
long taggerIdRecord = Fields.TaggerId.getRecPtr(db, record, 0);
taggerId = taggerIdRecord == 0L ? new String() : db.getString(taggerIdRecord)
.getString();
taggerId = taggerIdRecord == 0L ? "" : db.getString(taggerIdRecord).getString(); //$NON-NLS-1$
} catch (CoreException e) {
CCorePlugin.log(e);
}
}
return taggerId;
}
@Override
public int getDataLen() {
if (dataLen < 0)
if (dataLen < 0) {
try {
dataLen = Fields.DataLen.getInt(db, record, 0);
} catch (CoreException e) {
CCorePlugin.log(e);
return 0;
}
}
return dataLen;
}
@ -165,12 +165,13 @@ public class PDOMTag implements IWritableTag {
}
public void delete() {
if (db != null && record != 0)
if (db != null && record != 0) {
try {
db.free(record);
} catch (CoreException e) {
CCorePlugin.log(e);
}
}
}
public static class BTreeComparator implements IBTreeComparator {

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,8 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.tag;
import java.util.Collections;
@ -28,10 +27,6 @@ import org.eclipse.core.runtime.CoreException;
* Not thread-safe.
*/
public class PDOMTagIndex {
private final Database db;
private final long ptr;
private long rootRecord;
private static enum Fields {
TaggerIds, Tags, _last;
@ -39,6 +34,10 @@ public class PDOMTagIndex {
public static int sizeof = _last.ordinal() * Database.PTR_SIZE;
}
private final Database db;
private final long ptr;
private long rootRecord;
private PDOMStringSet taggerIds;
private BTree tags;
@ -80,8 +79,9 @@ public class PDOMTagIndex {
assert !taggerId.isEmpty();
if (db == null || taggerId == null || taggerId.isEmpty()
|| (taggerIds == null && !createIfNeeded))
|| (taggerIds == null && !createIfNeeded)) {
return 0L;
}
try {
long record = getTaggerIds().find(taggerId);
@ -181,8 +181,8 @@ public class PDOMTagIndex {
for (ITag tag : tags) {
ITag dupTag = newTags.put(tag.getTaggerId(), tag);
if (dupTag != null)
CCorePlugin
.log("Duplicate incoming tag for record " + binding_record + " from taggerId " + tag.getTaggerId()); //$NON-NLS-1$ //$NON-NLS-2$
CCorePlugin.log("Duplicate incoming tag for record " + binding_record //$NON-NLS-1$
+ " from taggerId " + tag.getTaggerId()); //$NON-NLS-1$
}
BTree btree = null;
@ -193,8 +193,7 @@ public class PDOMTagIndex {
return false;
}
PDOMTagSynchronizer sync = new PDOMTagSynchronizer(db, Long.valueOf(binding_record),
newTags);
PDOMTagSynchronizer sync = new PDOMTagSynchronizer(db, Long.valueOf(binding_record), newTags);
// visit the full tree, then return true on success and false on failure
try {
@ -210,8 +209,7 @@ public class PDOMTagIndex {
// insert any new tags that are left in the incoming list
for (ITag newTag : newTags.values()) {
IWritableTag pdomTag = createTag(binding_record, newTag.getTaggerId(),
newTag.getDataLen());
IWritableTag pdomTag = createTag(binding_record, newTag.getTaggerId(), newTag.getDataLen());
pdomTag.putBytes(0, newTag.getBytes(0, -1), -1);
}

View file

@ -1,4 +1,4 @@
/*
/*******************************************************************************
* Copyright (c) 2013 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -7,8 +7,7 @@
*
* Contributors:
* Andrew Eidsness - Initial implementation
*/
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.tag;
import org.eclipse.cdt.core.dom.ast.tag.ITag;