本文整理汇总了Java中java.util.LinkedList.add方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedList.add方法的具体用法?Java LinkedList.add怎么用?Java LinkedList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.LinkedList
的用法示例。
在下文中一共展示了LinkedList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readList
import java.util.LinkedList; //导入方法依赖的package包/类
private LinkedList<String> readList(Document xml) {
LinkedList<String> list = new LinkedList<>();
Element root = (Element) xml.getElementsByTagName(rootTagName).item(0);
NodeList nlItems = root.getElementsByTagName(elementTagName);
for (int i = 0; i < nlItems.getLength(); ++i) {
Node nListItem = nlItems.item(i);
if (nListItem.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
list.add(nListItem.getTextContent());
}
return list;
}
示例2: sel
import java.util.LinkedList; //导入方法依赖的package包/类
public List<Object> sel(String xpath) throws XpathSyntaxErrorException {
LinkedList res = new LinkedList();
try {
List e = this.xpathEva.xpathParser(xpath, this.elements);
Iterator msg1 = e.iterator();
while(msg1.hasNext()) {
JXNode j = (JXNode)msg1.next();
if(j.isText()) {
res.add(j.getTextVal());
} else {
res.add(j.getElement());
}
}
return res;
} catch (Exception var6) {
String msg = "please check the xpath syntax";
if(var6 instanceof NoSuchAxisException || var6 instanceof NoSuchFunctionException) {
msg = var6.getMessage();
}
throw new XpathSyntaxErrorException(msg);
}
}
示例3: getRepositories
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* Returns all repositories for the connector with the given ID
*
* @param connectorID
* @return
*/
public Collection<RepositoryImpl> getRepositories(String connectorID, boolean allKnown) {
LinkedList<RepositoryImpl> ret = new LinkedList<RepositoryImpl>();
lockRepositories();
try {
final Map<String, RepositoryImpl> m = repositories.get(connectorID);
if(m != null) {
ret.addAll(m.values());
}
} finally {
releaseRepositoriesLock();
}
if(allKnown) {
// team repos (not registered by user)
Collection<RepositoryImpl> repos = TeamRepositories.getInstance().getRepositories(false, true);
for (RepositoryImpl impl : repos) {
if(connectorID.equals(impl.getConnectorId())) {
ret.add(impl);
}
}
}
return ret;
}
示例4: pattern_PositionPointLink_2_3_findcontext_blackBBBBBBBB
import java.util.LinkedList; //导入方法依赖的package包/类
public static final Iterable<Object[]> pattern_PositionPointLink_2_3_findcontext_blackBBBBBBBB(Location srcLocation,
LocationToLocation locationToLocation, PositionPoint positionPoint,
outageDetectionJointarget.PositionPoint trgPositionPoint, outageDetectionJointarget.Location trgLocation,
MeterAssetPhysicalDevicePair pair, MeterAsset asset, PositionPointToPositionPoint positionCorr) {
LinkedList<Object[]> _result = new LinkedList<Object[]>();
if (trgLocation.equals(locationToLocation.getTarget())) {
if (asset.equals(pair.getA())) {
if (srcLocation.equals(locationToLocation.getSource())) {
if (srcLocation.equals(asset.getLocation())) {
if (positionPoint.equals(srcLocation.getPosition())) {
if (trgPositionPoint.equals(positionCorr.getTarget())) {
if (positionPoint.equals(positionCorr.getSource())) {
_result.add(new Object[] { srcLocation, locationToLocation, positionPoint,
trgPositionPoint, trgLocation, pair, asset, positionCorr });
}
}
}
}
}
}
}
return _result;
}
示例5: listUnitsInSystem
import java.util.LinkedList; //导入方法依赖的package包/类
public static LinkedList<String> listUnitsInSystem(String unitSystem){
LinkedList<String> unitList = listUnits();
LinkedList<String> unitsInSystem = new LinkedList<String>();
try {
UnitSystem us = UnitFilter.stringToUnitSystem(unitSystem);
Class c = us.getClass();
Method[] methodSet = c.getDeclaredMethods();
for (int i=0; i<methodSet.length;i++){
String s = methodSet[i].invoke(us).getClass().getName();
//System.out.println(s);
if (unitList.contains(s)){
unitsInSystem.add(s);
}
}
} catch (Throwable er) {
//System.err.println(er);
}
/*for(Iterator e = unitsInSystem.iterator(); e.hasNext();){
System.out.println(e.next().toString());
}*/
return unitsInSystem;
}
示例6: inviteCustomer
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public void inviteCustomer(QUser user, QCustomer customer) {
forBlink.add(user);
forShow.remove(user);
forShow.add(user);
if (!timer.isRunning()) {
timer.start();
if (flag) {
//todo board.showData(forShow, forBlink);
}
flag = false;
}
LinkedList<String> nests = new LinkedList<>();
for (QService service : QServiceTree.getInstance().getNodes()) {
if (service.isLeaf()) {
QCustomer customer_next = service.peekCustomer();
if (customer_next != null) {
nests.add(customer_next.getPrefix() + customer_next.getNumber());
}
}
}
//todo board.showNextCustomers(nests);
}
示例7: pattern_LocationLink_10_2_testcorematchandDECs_blackFFFB
import java.util.LinkedList; //导入方法依赖的package包/类
public static final Iterable<Object[]> pattern_LocationLink_10_2_testcorematchandDECs_blackFFFB(
EMoflonEdge _edge_Location) {
LinkedList<Object[]> _result = new LinkedList<Object[]>();
EObject tmpAsset = _edge_Location.getSrc();
if (tmpAsset instanceof MeterAsset) {
MeterAsset asset = (MeterAsset) tmpAsset;
EObject tmpLocation = _edge_Location.getTrg();
if (tmpLocation instanceof Location) {
Location location = (Location) tmpLocation;
if (location.equals(asset.getLocation())) {
for (MeterAssetMMXUPair pair : org.moflon.core.utilities.eMoflonEMFUtil
.getOppositeReferenceTyped(asset, MeterAssetMMXUPair.class, "a")) {
_result.add(new Object[] { pair, asset, location, _edge_Location });
}
}
}
}
return _result;
}
示例8: mapNetwork
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public boolean mapNetwork(SubstrateNetwork network, VirtualNetwork vNetwork) {
List<VirtualNetwork> vns = new LinkedList<VirtualNetwork>();
vns.add(vNetwork);
NetworkStack stack = new NetworkStack(network, vns);
LinkedList<IHiddenHopMapping> hhMappings = new LinkedList<IHiddenHopMapping>();
double hiddenHopsFactor = 0;
hhMappings.add(new BandwidthCpuHiddenHopMapping(hiddenHopsFactor));
AlgorithmParameter param = new AlgorithmParameter();
param.put("kShortestPath", "50");
param.put("distance", "35");
param.put("PathSplitting", "false");
param.put("eppstein", "false");
GenericMappingAlgorithm algo = new AvailableResources(param);
algo.setStack(stack);
if (algo instanceof GenericMappingAlgorithm)
((GenericMappingAlgorithm) algo).setHhMappings(hhMappings);
algo.performEvaluation();
return VnrUtils.isMapped(vNetwork);
}
示例9: processPathShowQuotasHuman
import java.util.LinkedList; //导入方法依赖的package包/类
@Test
public void processPathShowQuotasHuman() throws Exception {
Path path = new Path("mockfs:/test");
when(mockFs.getFileStatus(eq(path))).thenReturn(fileStat);
PathData pathData = new PathData(path.toString(), conf);
PrintStream out = mock(PrintStream.class);
Count count = new Count();
count.out = out;
LinkedList<String> options = new LinkedList<String>();
options.add("-q");
options.add("-h");
options.add("dummy");
count.processOptions(options);
count.processPath(pathData);
verify(out).println(HUMAN + WITH_QUOTAS + path.toString());
}
示例10: getChargingCollectionFunctionAddresses
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* <p>Get all the Charging Collection Function (CCF) Addresses set in this header</p>
*
* @return ListIterator that constains all CCF addresses of this header
*/
public ListIterator getChargingCollectionFunctionAddresses() {
Iterator li = this.parameters.iterator();
LinkedList ccfLIST = new LinkedList();
NameValue nv;
while (li.hasNext()) {
nv = (NameValue) li.next();
if (nv.getName().equalsIgnoreCase(ParameterNamesIms.CCF)) {
NameValue ccfNV = new NameValue();
ccfNV.setName(nv.getName());
ccfNV.setValueAsObject(nv.getValueAsObject());
ccfLIST.add(ccfNV);
}
}
return ccfLIST.listIterator();
}
示例11: pattern_LocationLink_2_2_corematch_blackFBBFFBFB
import java.util.LinkedList; //导入方法依赖的package包/类
public static final Iterable<Object[]> pattern_LocationLink_2_2_corematch_blackFBBFFBFB(MeterAsset asset,
Location location, MeterAssetPhysicalDevicePair pair, Match match) {
LinkedList<Object[]> _result = new LinkedList<Object[]>();
for (MeterAssetToEnergyConsumer assetToConumer : org.moflon.core.utilities.eMoflonEMFUtil
.getOppositeReferenceTyped(asset, MeterAssetToEnergyConsumer.class, "source")) {
EnergyConsumer consumer = assetToConumer.getTarget();
if (consumer != null) {
for (LocationToLocation locationCorr : org.moflon.core.utilities.eMoflonEMFUtil
.getOppositeReferenceTyped(location, LocationToLocation.class, "source")) {
outageDetectionJointarget.Location trgLocation = locationCorr.getTarget();
if (trgLocation != null) {
_result.add(new Object[] { consumer, asset, location, assetToConumer, trgLocation, pair,
locationCorr, match });
}
}
}
}
return _result;
}
示例12: checkAnnotationViolations
import java.util.LinkedList; //导入方法依赖的package包/类
public <T> List<LicenseViolation> checkAnnotationViolations(T obj, List<Product> products) {
LinkedList causes = new LinkedList();
if(!this.isAllowedByAnnotations(obj, products)) {
List licenseLevelAnnotations = this.getLicenseAnnotations(obj, LicenseLevel.class);
Iterator constraintAnnotations = licenseLevelAnnotations.iterator();
while(constraintAnnotations.hasNext()) {
LicenseLevel annotation = (LicenseLevel)constraintAnnotations.next();
if(!this.isAllowedByLicenseLevel(annotation, products)) {
License annotation1 = null;
try {
annotation1 = this.getActiveLicense(annotation.productId(), products);
} catch (UnknownProductException var9) {
;
}
causes.add(new LicenseLevelViolation(obj, annotation1, annotation));
}
}
List constraintAnnotations1 = this.getLicenseAnnotations(obj, LicenseConstraint.class);
Iterator annotation2 = constraintAnnotations1.iterator();
while(annotation2.hasNext()) {
LicenseConstraint annotation3 = (LicenseConstraint)annotation2.next();
this.checkForLicenseConstraintViolation(products, causes, annotation3);
}
}
return causes;
}
示例13: rules
import java.util.LinkedList; //导入方法依赖的package包/类
public void rules ()
{
this.readLock.lock ();
try
{
final List<String> header = Arrays.asList ( "Prio", "ID", "Realized", "Error" );
final List<List<String>> data = new LinkedList<> ();
for ( final Entry entry : this.entries )
{
final LinkedList<String> row = new LinkedList<> ();
row.add ( "" + entry.priority );
row.add ( entry.id );
row.add ( entry.isRealized () ? "X" : "" );
if ( entry.error != null )
{
row.add ( ExceptionHelper.getMessage ( entry.error ) );
}
else
{
row.add ( "" );
}
data.add ( row );
}
// will be redirected by the gogo shell
Tables.showTable ( System.out, header, data, 1 );
}
finally
{
this.readLock.unlock ();
}
}
示例14: searchAPI
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* Perform a query on a given UCL API connection and return an array of bookings.
* @param conn UCLApiConnection
* @param endpoint the API path
* @param params hashtable of query parameters
* @return Array of bookings
*/
public static Booking[] searchAPI(UCLApiConnection conn, String endpoint, Hashtable<String, String> params) {
try {
boolean cont = true;
LinkedList<Booking> bookings = new LinkedList<Booking>();
while (cont == true) {
String response = conn.queryAPI(endpoint, params);
JSONParser p = new JSONParser();
JSONObject responseObject = (JSONObject)p.parse(response);
JSONArray bs = (JSONArray)responseObject.get("bookings");
int nBookings = bs.size();
for (int i = 0; i < nBookings; i++) {
bookings.add(new Booking((JSONObject)bs.get(i)));
}
cont = (boolean)responseObject.get("next_page_exists");
if (cont) {
params.put("page_token",(String)responseObject.get("page_token"));
}
}
return bookings.toArray(new Booking[bookings.size()]);
} catch (Exception e){
System.err.println(e.toString());
if (uclapi.UCLApiConnection.ExitOnException) {
System.exit(5);
}
}
return new Booking[0];
}
示例15: isPatternMatch
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public boolean isPatternMatch(AbstractExpr aePattern,
LinkedList<PatternExprUnitMap> listpeuMapPseudoFuncs,
LinkedList<PatternExprUnitMap> listpeuMapPseudoConsts,
LinkedList<PatternExprUnitMap> listpeuMapUnknowns,
boolean bAllowConversion) throws JFCALCExpErrException, JSmartMathErrException, InterruptedException {
/* do not call isPatternDegrade function because generally compare expression cannot degrade-match a pattern.*/
if (aePattern.menumAEType == ABSTRACTEXPRTYPES.ABSTRACTEXPR_VARIABLE) {
// unknown variable
for (int idx = 0; idx < listpeuMapUnknowns.size(); idx ++) {
if (listpeuMapUnknowns.get(idx).maePatternUnit.isEqual(aePattern)) {
if (isEqual(listpeuMapUnknowns.get(idx).maeExprUnit)) {
// this unknown variable has been mapped to an expression and the expression is the same as this
return true;
} else {
// this unknown variable has been mapped to an expression but the expression is not the same as this
return false;
}
}
}
// the aePattern is an unknown variable and it hasn't been mapped to some expressions before.
PatternExprUnitMap peuMap = new PatternExprUnitMap(this, aePattern);
listpeuMapUnknowns.add(peuMap);
return true;
}
if (!(aePattern instanceof AECompare)) {
return false;
}
if (moptType != ((AECompare)aePattern).moptType) {
return false;
}
if (maeLeft.isPatternMatch(((AECompare)aePattern).maeLeft, listpeuMapPseudoFuncs, listpeuMapPseudoConsts, listpeuMapUnknowns, bAllowConversion) == false) {
return false;
}
if (maeRight.isPatternMatch(((AECompare)aePattern).maeRight, listpeuMapPseudoFuncs, listpeuMapPseudoConsts, listpeuMapUnknowns, bAllowConversion) == false) {
return false;
}
return true;
}