Convenience factory method to create a Bridge object from two call ids
@param callId1 the call id
@param callId2 the call id
@return the Bridge
@throws IOException unexpected error.
546524
public static Bridge create(final String callId1, final String callId2)
    	    throws Exception {
    	assert (callId1 != null);
    	final BandwidthClient client = BandwidthClient.getInstance();
    	return create(client, callId1, callId2);
	}
1018656
public void align(Structure s1, String chainId1, Structure s2,
			String chainId2) throws StructureException {
		align(s1, chainId1, s2, chainId2, params);
	}
1206945
public boolean startCall(MuxInputStream in, MuxOutputStream out)
        throws IOException
    {
        int channel = isClient ? 2 : 3;

        return startCall(channel, in, out);
    }
706422
public static Call get(final BandwidthClient client, final String callId) throws Exception {
    	
        final String callsUri = client.getUserResourceInstanceUri(BandwidthConstants.CALLS_URI_PATH, callId);
        
        final JSONObject jsonObject = toJSONObject(client.get(callsUri, null));
        
        return new Call(client, jsonObject);
    }
1114877
private List<IAtom> getUnion(List<IAtom> list1, List<IAtom> list2) {
        // FIXME: the JavaDoc does not describe what happens: that vec1 gets to be the union!
        // jm: pretty sure retainAll would do the trick here but don't want to change the
        //     functionality as item only present in list1 are not removed (i.e. not union)
        List<IAtom> is = new ArrayList<IAtom>(list1);
        for (int f = list2.size() - 1; f > -1; f--) {
            if (!list1.contains(list2.get(f))) is.add(list2.get(f));
        }
        return is;
    }
587872
public static Value.Builder makeValue(Value.Builder value1, Value.Builder value2,
      Value.Builder... rest) {
    ArrayValue.Builder arrayValue = ArrayValue.newBuilder();
    arrayValue.addValues(value1);
    arrayValue.addValues(value2);
    for (Value.Builder builder : rest) {
      arrayValue.addValues(builder);
    }
    return Value.newBuilder().setArrayValue(arrayValue);
  }
1045055
public static Bridge create(final BandwidthClient client, final String callId1, final String callId2)
    	    throws Exception 
    {
    	assert (callId1 != null);

    	final HashMap<String, Object> params = new HashMap<String, Object>();

    	params.put("bridgeAudio", "true");

        String[] callIds = null;

        if (callId1 != null && callId2 != null) {
            callIds = new String[] { callId1, callId2 };
        } else if (callId1 != null && callId2 == null) {
            callIds = new String[] { callId1 };
        } else if (callId1 == null && callId2 != null) {
            callIds = new String[] { callId2 };
        }

    	params.put("callIds", callIds == null ? Collections.emptyList()
    		: Arrays.asList(callIds));

    	return create(client, params);
	}
398092
public static <T extends ModifierReviewable.ForMethodDescription> ElementMatcher.Junction<T> isBridge() {
        return new ModifierMatcher<T>(ModifierMatcher.Mode.BRIDGE);
    }
120040
protected String callBridge(RestHttpHelper restHelper, String bridgeURL) {
        log.info("Making bridge call to get snapshot contents. URL: {}", bridgeURL);

        try {
            RestHttpHelper.HttpResponse response = restHelper.get(bridgeURL);
            int statusCode = response.getStatusCode();
            if (statusCode != 200) {
                throw new RuntimeException("Unexpected response code: " +
                                           statusCode);
            }
            return response.getResponseBody();
        } catch (Exception e) {
            throw new TaskException("Exception encountered attempting to " +
                                    "get snapshot contents. " +
                                    "Error reported: " + e.getMessage(), e);
        }
    }
699345
public boolean addBridge(BetaBridge bridge) {
		if (bridge1 == null) {
			bridge1 = bridge;
			return true;
		} else if (bridge1.equals(bridge)) {
			return true;
		} else if (bridge2 == null) {
			bridge2 = bridge;
			return true;
		} else if (bridge2.equals(bridge)) {
			return true;
		} else { //no space left, cannot add the bridge
			logger.info("Residue forms more than 2 beta Bridges, "
					+ "DSSP output might differ in Bridges column.");
			return false;
		}
	}
812803
public static Object call2(Callable fun, Scriptable thisObj,
                               Object arg0, Object arg1,
                               Context cx, Scriptable scope)
    {
        return fun.call(cx, scope, thisObj, new Object[] { arg0, arg1 });
    }
1262331
public function bridge_create($type = NULL, $bridgeId = NULL, $name = NULL)
	{
		return $this->create($type, $bridgeId, $name);
	}
286022
@SuppressWarnings({"unchecked", "rawtypes"})
    private InternalNode<?> combineIDDSameLevel(InternalNode n1,
                                                InternalNode n2) throws MIDDException {
        if (n1.getID() != n2.getID()) {
            throw new IllegalArgumentException("Both params should have the same variable level at their root");
        }

        if (n1.getType() != n2.getType()) {
            throw new IllegalArgumentException("Both IDD roots should have the same data type");
        }

        Partition p1 = PartitionBuilder.createPartition(n1.getIntervals());
        Partition p2 = PartitionBuilder.createPartition(n2.getIntervals());

        Partition<?> p = PartitionBuilder.union(p1, p2);
        if (p.size() == 0) {
            log.error("Empty unioned partition");
            return null;
        }

        InternalNodeState newState = combineIndeterminateStates(n1.getState(), n2.getState());

        InternalNode<?> n = NodeUtils.createInternalNode(n1.getID(), newState, n1.getType());

        for (Interval<?> interval : p.getIntervals()) {
            AbstractNode op1 = n1.getChild(interval);
            AbstractNode op2 = n2.getChild(interval);
            AbstractNode child = null;
            if (op1 != null && op2 != null) {
                child = combine(op1, op2);
            } else if (op1 != null || op2 != null) {
                child = GenericUtils.newInstance(op1 == null ? op2 : op1);
            } else {
                throw new RuntimeException("Error merging two partitions, " +
                        "the output partition has an item not belong to both previous ones");
            }

            if (child != null) {
                AbstractEdge<?> edge = EdgeUtils.createEdge(interval, n.getType());
                if (edge.getIntervals().size() == 0) {
                    throw new RuntimeException("Empty edge");
                }
                n.addChild(edge, child);
            }
        }

        return n;
    }
1283180
public RxLoader2<A, B, T> start(A arg1, B arg2) {
        start(observableFunc.call(arg1, arg2));
        return this;
    }
83419
public static <T1, T2> Tuple2<T1, T2> create(final T1 v1, final T2 v2) {
        return new Tuple2<T1, T2>(v1, v2);
    }
1364881
public final <T1, T2> Tuple2<T1, T2> concat(Tuple2<T1, T2> tuple) {
        return new Tuple2<>(tuple.v1, tuple.v2);
    }
440348
public static <T1, T2> TypeFactory<Tuple2<T1, T2>> typeFactory( TypeFactory<T1> type1,
                                                                    TypeFactory<T2> type2 ) {
        return new Tuple2TypeFactory<>(type1, type2);
    }