当前位置: 首页>>代码示例>>Java>>正文


Java IntArrayList.add方法代码示例

本文整理汇总了Java中cern.colt.list.IntArrayList.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList.add方法的具体用法?Java IntArrayList.add怎么用?Java IntArrayList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cern.colt.list.IntArrayList的用法示例。


在下文中一共展示了IntArrayList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: genInputPlaces

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private ArrayList genInputPlaces(int ith)
{
    ArrayList tuples = new ArrayList();
    //get all predecessors
    IntArrayList ialPred = getPred(ith, false);
    //enumerate all the relevant causual dependencies
    for (int i = 0; i < ialPred.size(); i++)
    {
        int pred = ialPred.get(i);
        IntArrayList ialSucc = getSucc(pred, false);
        for (int j = 0; j < ialSucc.size(); j++)
        {
            int succ = ialSucc.get(j);
            IntArrayList A = new IntArrayList();
            A.add(pred);
            IntArrayList B = new IntArrayList();
            B.add(succ);
            ExpandTree(tuples, A, B, 0, 0);
        }
    }

    return tuple2Place(ith, tuples, 1);
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:24,代码来源:ModifiedAlphaSharpProcessMiner.java

示例2: genOutputPlaces

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private ArrayList genOutputPlaces(int ith)
{
    ArrayList tuples = new ArrayList();
    //get all successors
    IntArrayList ialSucc = getSucc(ith, false);
    //enumerate all the relevant causual dependencies
    for (int i = 0; i < ialSucc.size(); i++)
    {
        int succ = ialSucc.get(i);
        IntArrayList ialPred = getPred(succ, false);
        for (int j = 0; j < ialPred.size(); j++)
        {
            int pred = ialPred.get(j);
            IntArrayList A = new IntArrayList();
            A.add(pred);
            IntArrayList B = new IntArrayList();
            B.add(succ);
            ExpandTree(tuples, A, B, 0, 0);
        }
    }

    return tuple2Place(ith, tuples, 0);
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:24,代码来源:ModifiedAlphaSharpProcessMiner.java

示例3: getPredPred

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
public IntArrayList getPredPred()
{
    IntArrayList alTask = new IntArrayList();
    for (int i = 0; i < alPred.size(); i++)
    {
        DoubleSet ds = (DoubleSet) alPred.get(i);
        IntArrayList sarPred = ds.getA();
        for (int j = 0; j < sarPred.size(); j++)
        {
            if (!alTask.contains(sarPred.get(j)))
            {
                alTask.add(sarPred.get(j));
            }
        }
    }

    return alTask;
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:19,代码来源:ModifiedAlphaSharpProcessMiner.java

示例4: getSuccSucc

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
public IntArrayList getSuccSucc()
{
    IntArrayList alTask = new IntArrayList();
    for (int i = 0; i < alSucc.size(); i++)
    {
        DoubleSet ds = (DoubleSet) alSucc.get(i);
        IntArrayList sarSucc = ds.getB();
        for (int j = 0; j < sarSucc.size(); j++)
        {
            if (!alTask.contains(sarSucc.get(j)))
            {
                alTask.add(sarSucc.get(j));
            }
        }
    }

    return alTask;
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:19,代码来源:ModifiedAlphaSharpProcessMiner.java

示例5: for

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fill like: <tt>for (slice = 0..slices-1) for (row = 0..rows-1) for (column = 0..colums-1) do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
For an example, see {@link DoubleMatrix2D#getNonZeros(IntArrayList,IntArrayList,DoubleArrayList)}.

@param sliceList the list to be filled with slice indexes, can have any size.
@param rowList the list to be filled with row indexes, can have any size.
@param columnList the list to be filled with column indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList sliceList, IntArrayList rowList, IntArrayList columnList, DoubleArrayList valueList) {
	sliceList.clear(); 
	rowList.clear(); 
	columnList.clear(); 
	valueList.clear();
	int s = slices;
	int r = rows;
	int c = columns;
	for (int slice=0; slice < s; slice++) {
		for (int row=0; row < r; row++) {
			for (int column=0; column < c; column++) {
				double value = getQuick(slice,row,column);
				if (value != 0) {
					sliceList.add(slice);
					rowList.add(row);
					columnList.add(column);
					valueList.add(value);
				}
			}
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:39,代码来源:DoubleMatrix3D.java

示例6: for

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fill like: <tt>for (slice = 0..slices-1) for (row = 0..rows-1) for (column = 0..colums-1) do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
For an example, see {@link ObjectMatrix2D#getNonZeros(IntArrayList,IntArrayList,ObjectArrayList)}.

@param sliceList the list to be filled with slice indexes, can have any size.
@param rowList the list to be filled with row indexes, can have any size.
@param columnList the list to be filled with column indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList sliceList, IntArrayList rowList, IntArrayList columnList, ObjectArrayList valueList) {
	sliceList.clear(); 
	rowList.clear(); 
	columnList.clear(); 
	valueList.clear();
	int s = slices;
	int r = rows;
	int c = columns;
	for (int slice=0; slice < s; slice++) {
		for (int row=0; row < r; row++) {
			for (int column=0; column < c; column++) {
				Object value = getQuick(slice,row,column);
				if (value != null) {
					sliceList.add(slice);
					rowList.add(row);
					columnList.add(column);
					valueList.add(value);
				}
			}
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:39,代码来源:ObjectMatrix3D.java

示例7: getPred

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private IntArrayList getPred(int col, boolean noLoop)
{
    IntArrayList ialPred = new IntArrayList();
    DoubleMatrix1D dm = relations.getCausalFollowerMatrix().viewColumn(col);
    for (int i = 0; i < nme; i++)
    {
        if (noLoop && relations.getOneLengthLoopsInfo().get(i) > 0)
            continue;
        if (dm.get(i) > 0)
            ialPred.add(i);
    }
    return ialPred;
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:14,代码来源:ModifiedAlphaSharpProcessMiner.java

示例8: getSucc

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private IntArrayList getSucc(int row, boolean noLoop)
{
    IntArrayList ialPred = new IntArrayList();
    DoubleMatrix1D dm = relations.getCausalFollowerMatrix().viewRow(row);
    for (int i = 0; i < nme; i++)
    {
        if (noLoop && relations.getOneLengthLoopsInfo().get(i) > 0)
            continue;
        if (dm.get(i) > 0)
            ialPred.add(i);
    }
    return ialPred;
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:14,代码来源:ModifiedAlphaSharpProcessMiner.java

示例9: toPositions

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private int[] toPositions(final double[] objNodes, final Double[] totalNodes) {
  int nObjNodes = objNodes.length;
  int nTotalNodes = totalNodes.length;

  IntArrayList result = new IntArrayList();
  for (int i = 0; i < nObjNodes; ++i) {
    boolean findNodes = false;
    for (int j = 0; j < nTotalNodes; ++j) {
      if (Math.abs(objNodes[i] - totalNodes[j]) < TOL) {
        result.add(j);
        findNodes = true;
      }
    }
    if (!findNodes) {
      s_logger.info(i + "-th objective node with value " + objNodes[i] + " is not found in curve nodes");
    }
  }

  int nObjInt = result.size();
  ArgumentChecker.isTrue(nObjInt > 0, "None of the objective nodes are found in curve nodes");
  int[] res = new int[nObjInt];
  for (int i = 0; i < nObjInt; ++i) {
    res[i] = result.get(i);
  }

  return res;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:28,代码来源:ParameterSensitivityWeightMatrixCalculator.java

示例10: createNewTransitions

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
 * Parses the provided FSMPDA and converts the old transitions to new ones. The 
 * {@link #newStates} list and the {@link #oldToNewStates} mapping should 
 * already be populated before this method is called. 
 * @param fsm
 * @throws ResourceInstantiationException 
 */
protected void createNewTransitions(FSMPDA fsm) 
    throws ResourceInstantiationException{
  LinkedList<StatePDA> oldStatesQueue = new LinkedList<StatePDA>();
  oldStatesQueue.add(fsm.getInitialState());
  IntArrayList visitedOldStates = new IntArrayList();
  while(oldStatesQueue.size() > 0){
    StatePDA anOldState = oldStatesQueue.removeFirst();
    if(visitedOldStates.contains(anOldState.getIndex())){
      //state already processed -> nothing to do
    }else{
      if(!oldToNewStates.containsKey(anOldState.getIndex())){
        throw new ResourceInstantiationException(
                "State mapping error: " +
                "old state not associated with a new state!");
      }
      SPTBase.State newState = newStates.get(oldToNewStates.get(
              anOldState.getIndex()));
      //now process all transitions
      List<SPTBase.Transition> newTransitions = 
          new LinkedList<SPTBase.Transition>();
      for(gate.fsm.Transition t : anOldState.getTransitions()){
        TransitionPDA anOldTransition = (TransitionPDA) t;
        if(!visitedOldStates.contains(anOldTransition.getTarget().getIndex())){
          oldStatesQueue.add((StatePDA) anOldTransition.getTarget());
        }
        if(!oldToNewStates.containsKey(anOldTransition.getTarget().getIndex())){
          throw new ResourceInstantiationException(
                  "State mapping error: " +
                  "old target state not associated with a new state!");
        }
        int newStateTarget = oldToNewStates.get(anOldTransition.getTarget().getIndex());
        SPTBase.Transition newTransition = new SPTBase.Transition();
        newTransitions.add(newTransition);
        newTransition.nextState = newStateTarget;
        newTransition.type = anOldTransition.getType();
        if(newTransition.type != TransitionPDA.TYPE_CONSTRAINT){
      	  continue;
        }
        Constraint[] oldConstraints = anOldTransition.getConstraints().
            getConstraints();
        List<int[]> newConstraints = new ArrayList<int[]>();
        for(int i = 0; i< oldConstraints.length; i++){
          String annType = oldConstraints[i].getAnnotType();
          int annTypeInt = annotationTypes.indexOf(annType);
          if(annTypeInt < 0){
            annotationTypes.add(annType);
            annTypeInt = annotationTypes.size() -1;
          }
          int[] newConstraint = new int[oldConstraints[i].
                                        getAttributeSeq().size() + 2];
          newConstraints.add(newConstraint);
          newConstraint[0] = annTypeInt;
          newConstraint[1] = oldConstraints[i].isNegated() ? -1 : 0;
          int predId = 2;
          for(ConstraintPredicate oldPredicate : 
              oldConstraints[i].getAttributeSeq()){
            newConstraint[predId++] = convertPredicate(annType, oldPredicate);
          }
        }
        //now save the new constraints
        newTransition.constraints = new int[newConstraints.size()][];
        newTransition.constraints = newConstraints.toArray(
                newTransition.constraints);
      }
      //convert the transitions list to an array
      newState.transitions = new SPTBase.Transition[newTransitions.size()];
      newState.transitions = newTransitions.toArray(newState.transitions);
      
      //finally, mark the old state as visited.
      visitedOldStates.add(anOldState.getIndex());
    }
  }
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:81,代码来源:SPTBuilder.java

示例11: ExpandTree

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
private boolean ExpandTree(ArrayList tuples, IntArrayList A, IntArrayList B, int sA, int sB)
{
    boolean expanded = false;

    int s = sA;
    if (sB < s)
    {
        s = sB;
        // Look for an element that can be added to A, such that
        // it has no relation with any task in A, and is a causal predecessor of all tasks in B
    }
    for (int i = s; i < nme; i++)
    {
        boolean c = (i >= sA) && !A.contains(i);
        if (c)
        {
            for (int j = 0; j < A.size(); j++)
            {
                c = c && (relations.getCausalFollowerMatrix().get(i, A.get(j)) == 0 || relations.getCausalFollowerMatrix().get(i, A.get(j)) > 0 && relations.getOneLengthLoopsInfo().get(A.get(j)) > 0)
                    && (relations.getCausalFollowerMatrix().get(A.get(j), i) == 0 || relations.getCausalFollowerMatrix().get(A.get(j), i) > 0 && relations.getOneLengthLoopsInfo().get(i) > 0)
                    && (relations.getParallelMatrix().get(i, A.get(j)) == 0);
                // c == i does not have a relation with any element of A
            }
        }
        if (c)
        {
            for (int j = 0; j < B.size(); j++)
            {
                c = c && (relations.getCausalFollowerMatrix().get(i, B.get(j)) > 0);
                // c == i is a causal predecessor of all elements of B
            }
        }
        boolean d = (i >= sB) && !B.contains(i);
        if (d)
        {
            for (int j = 0; j < B.size(); j++)
            {
                d = d && (relations.getCausalFollowerMatrix().get(i, B.get(j)) == 0 || relations.getCausalFollowerMatrix().get(i, B.get(j)) > 0 && relations.getOneLengthLoopsInfo().get(i) > 0)
                    && (relations.getCausalFollowerMatrix().get(B.get(j), i) == 0 || relations.getCausalFollowerMatrix().get(B.get(j), i) > 0 && relations.getOneLengthLoopsInfo().get(B.get(j)) > 0)
                    && (relations.getParallelMatrix().get(i, B.get(j)) == 0);
                // d == i does not have a relation with any element of B
            }
        }
        if (d)
        {
            for (int j = 0; j < A.size(); j++)
            {
                d = d && (relations.getCausalFollowerMatrix().get(A.get(j), i) > 0);
                // d == i is a causal successor of all elements of A
            }
        }
        IntArrayList tA = (IntArrayList) A.clone();
        IntArrayList tB = (IntArrayList) B.clone();

        if (c)
        {
            // i can be added to A
            A.add(i);
            expanded = ExpandTree(tuples, A, B, i + 1, sB);
            A = tA;
        }
        if (d)
        {
            // i can be added to B
            B.add(i);
            expanded = ExpandTree(tuples, A, B, sA, i + 1);
            B = tB;
        }
    }
    if (!expanded)
    {
        IntArrayList[] t = new IntArrayList[2];
        t[0] = (IntArrayList) A.clone();
        t[1] = (IntArrayList) B.clone();
        tuples.add(t);
        expanded = true;
    }
    return expanded;
}
 
开发者ID:raffaeleconforti,项目名称:ResearchCode,代码行数:80,代码来源:ModifiedAlphaSharpProcessMiner.java

示例12: get

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fills like: <tt>for (index = 0..size()-1)  do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
<p>
<b>Example:</b>
<br>
<pre>
0, 0, 8, 0, 7
-->
indexList  = (2,4)
valueList  = (8,7)
</pre>
In other words, <tt>get(2)==8, get(4)==7</tt>.

@param indexList the list to be filled with indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList indexList, DoubleArrayList valueList, int maxCardinality) {
	boolean fillIndexList = indexList != null;
	boolean fillValueList = valueList != null;
	int card = cardinality(maxCardinality);
	if (fillIndexList) indexList.setSize(card);
	if (fillValueList) valueList.setSize(card);
	if (!(card<maxCardinality)) return;

	if (fillIndexList) indexList.setSize(0);
	if (fillValueList) valueList.setSize(0);
	int s = size;
	for (int i=0; i < s; i++) {
		double value = getQuick(i);
		if (value != 0) {
			if (fillIndexList) indexList.add(i);
			if (fillValueList) valueList.add(value);
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:43,代码来源:DoubleMatrix1D.java

示例13: for

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fills like <tt>for (row = 0..rows-1) for (column = 0..columns-1) do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
<p>
<b>Example:</b>
<br>
<pre>
2 x 3 matrix:
0, 0, 8
0, 7, 0
-->
rowList    = (0,1)
columnList = (2,1)
valueList  = (8,7)
</pre>
In other words, <tt>get(0,2)==8, get(1,1)==7</tt>.

@param rowList the list to be filled with row indexes, can have any size.
@param columnList the list to be filled with column indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList rowList, IntArrayList columnList, DoubleArrayList valueList) {
	rowList.clear(); 
	columnList.clear(); 
	valueList.clear();
	int r = rows;
	int c = columns;
	for (int row=0; row < r; row++) {
		for (int column=0; column < c; column++) {
			double value = getQuick(row,column);
			if (value != 0) {
				rowList.add(row);
				columnList.add(column);
				valueList.add(value);
			}
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:45,代码来源:DoubleMatrix2D.java

示例14: for

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
Fills the coordinates and values of cells having non-zero values into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists all have a new size, the number of non-zero values.
<p>
In general, fill order is <i>unspecified</i>.
This implementation fills like <tt>for (row = 0..rows-1) for (column = 0..columns-1) do ... </tt>.
However, subclasses are free to us any other order, even an order that may change over time as cell values are changed.
(Of course, result lists indexes are guaranteed to correspond to the same cell).
<p>
<b>Example:</b>
<br>
<pre>
2 x 3 matrix:
0, 0, 8
0, 7, 0
-->
rowList    = (0,1)
columnList = (2,1)
valueList  = (8,7)
</pre>
In other words, <tt>get(0,2)==8, get(1,1)==7</tt>.

@param rowList the list to be filled with row indexes, can have any size.
@param columnList the list to be filled with column indexes, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void getNonZeros(IntArrayList rowList, IntArrayList columnList, ObjectArrayList valueList) {
	rowList.clear(); 
	columnList.clear(); 
	valueList.clear();
	int r = rows;
	int c = columns;
	for (int row=0; row < r; row++) {
		for (int column=0; column < c; column++) {
			Object value = getQuick(row,column);
			if (value != null) {
				rowList.add(row);
				columnList.add(column);
				valueList.add(value);
			}
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:45,代码来源:ObjectMatrix2D.java

示例15: IntIntProcedure

import cern.colt.list.IntArrayList; //导入方法依赖的package包/类
/**
Fills all pairs satisfying a given condition into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}.
<p>
<b>Example:</b>
<br>
<pre>
IntIntProcedure condition = new IntIntProcedure() { // match even keys only
	public boolean apply(int key, int value) { return key%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
</pre>

@param condition    the condition to be matched. Takes the current key as first and the current value as second argument.
@param keyList the list to be filled with keys, can have any size.
@param valueList the list to be filled with values, can have any size.
*/
public void pairsMatching(final IntIntProcedure condition, final IntArrayList keyList, final IntArrayList valueList) {
	keyList.clear();
	valueList.clear();
	
	for (int i = table.length ; i-- > 0 ;) {
		if (state[i]==FULL && condition.apply(table[i],values[i])) {
			keyList.add(table[i]);
			valueList.add(values[i]);
		}
	}
}
 
开发者ID:dmcennis,项目名称:jAudioGIT,代码行数:31,代码来源:OpenIntIntHashMap.java


注:本文中的cern.colt.list.IntArrayList.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。