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


Java Triple.of方法代码示例

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


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

示例1: postTask

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
/**
 * Posts a new task for the thread to process.
 * 
 * @param holder
 *            the result holder in which the measure result will be saved
 * @param hierarchy
 *            the hierarchy for which the measure is to be computed
 * @param task
 *            the task to post
 */
public void postTask( MeasureResultHolder holder, Hierarchy hierarchy, MeasureTask task )
{
	if ( holder == null ) {
		throw new IllegalArgumentException( "Holder must not be null!" );
	}
	if ( hierarchy == null ) {
		throw new IllegalArgumentException( "Hierarchy must not be null!" );
	}
	if ( task == null ) {
		throw new IllegalArgumentException( "Task must not be null!" );
	}

	Triple<MeasureResultHolder, Hierarchy, MeasureTask> arg = Triple.of( holder, hierarchy, task );

	lock.lock();
	try {
		tasks.add( arg );
	}
	finally {
		lock.unlock();
	}

	taskPosted.broadcast( Pair.of( hierarchy, task ) );
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:35,代码来源:MeasureComputeThread.java

示例2: loadAuthentication

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
public OAuth2Authentication loadAuthentication(String accessToken)
        throws AuthenticationException, InvalidTokenException {
    OAuth2Authentication authentication = super.loadAuthentication(accessToken);
    OAuth2Request request = authentication.getOAuth2Request();
    UsernamePasswordAuthenticationToken token = UsernamePasswordAuthenticationToken.class.cast(authentication.getUserAuthentication());
    Map<String, Object> map = Map.class.cast(token.getDetails());

    String id = map.getOrDefault("id", "").toString();
    Triple<OAuthSource, String, Integer> principal = Triple.of(source, id, null);
    Object credentials = token.getCredentials();
    List<GrantedAuthority> authorities = Lists.newArrayList(token.getAuthorities());

    OAuthUser user = this.repository.findBySourceAndId(source, id);
    if (user != null) {
        Assert.state(user.getUser() != null);
        principal = Triple.of(source, id, user.getUser().getId());
        authorities.add(new SimpleGrantedAuthority("ROLE_SU"));
    }

    token = new UsernamePasswordAuthenticationToken(principal, credentials, authorities);
    token.setDetails(map);
    return new OAuth2Authentication(request, token);
}
 
开发者ID:HeroXXiv,项目名称:Robocode,代码行数:25,代码来源:SecurityConfig.java

示例3: getRelativeState

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private Triple<IBlockState, EnumFacing, NBTTagCompound> getRelativeState() {
	NBTTagCompound tag = new NBTTagCompound();
	BlockPos pos = getPos().offset(getFacingLazy());
	IBlockState state = world.getBlockState(pos);
	getTile(TileEntity.class, world, pos).ifPresent(tile -> {
		tile.writeToNBT(tag);
		tag.removeTag("x");
		tag.removeTag("y");
		tag.removeTag("z");
		world.removeTileEntity(pos);
	});
	world.setBlockToAir(pos);
	return Triple.of(state, getFacingLazy(), tag);
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:15,代码来源:TileMechanicalTranslocator.java

示例4: anim

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private Triple<Integer, Integer, Float> anim() throws IOException
{
    chunk("ANIM");
    int flags = buf.getInt();
    int frames = buf.getInt();
    float fps = buf.getFloat();
    dump("ANIM(" + flags + ", " + frames + ", " + fps + ")");
    popLimit();
    return Triple.of(flags, frames, fps);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:B3DModel.java

示例5: canPerform

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
/**
 * Is this user allowed to do this operation in this channel?
 *
 * @param permissionName requested permission name
 * @param user           action invoker
 * @param channel        action location
 * @return <code>true</code> if the user is allowed to perform the action, <code>false</code> otherwise.
 */
@Timed
public boolean canPerform(String permissionName, IUser user, IChannel channel) {
    Triple<String, String, String> key = Triple.of(permissionName, user == null ? "0" : user.getID(), channel.getID());
    Boolean cached = permissionCache.get(key);
    if (cached != null) {
        return cached;
    } else {
        boolean result = slowCanPerform(permissionName, user, channel);
        log.debug("Caching result of {} -> {}", keyToString(permissionName, user, channel), result);
        permissionCache.put(key, result);
        return result;
    }
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:22,代码来源:PermissionService.java

示例6: fromDouble

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
public Triple<Double, Double, Double> fromDouble(Triple<Double, Double, Double> value, double d) {
    switch (element) {
        case LEFT: return Triple.of(d, value.getMiddle(), value.getRight());
        case MIDDLE: return Triple.of(value.getLeft(), d, value.getRight());
        case RIGHT: return Triple.of(value.getLeft(), value.getMiddle(), d);
    }
    throw new AssertionError(element);
}
 
开发者ID:ReplayMod,项目名称:ReplayStudio,代码行数:10,代码来源:PropertyParts.java

示例7: generateWidget

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
/**
 * Generate a widget for the given id.
 * 
 * @param widgetIdentifier
 *            the widget identifier
 * @param page
 *            the page to add the widget
 * @param pluginConfiguration
 *            the corresponding plugin configuration
 * @param info
 *            the corresponding plugin info
 * 
 * @return a triple<widgetId, url, widgetIdentifier>
 */
private Triple<Long, String, String> generateWidget(String widgetIdentifier, DashboardPage page, PluginConfiguration pluginConfiguration,
        IPluginInfo info) {

    DashboardWidget widget = new DashboardWidget();
    widget.color = DashboardWidgetColor.PRIMARY.getColor();
    widget.dashboardPage = page;
    widget.identifier = widgetIdentifier;
    widget.pluginConfiguration = pluginConfiguration;
    widget.title = "";
    widget.config = null;
    widget.save();

    return Triple.of(widget.id, info.getLinkToDisplayWidget(widgetIdentifier, widget.id), widgetIdentifier);
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:29,代码来源:DashboardController.java

示例8: tripleFrom

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private static Triple<String, String, String> tripleFrom(String key, String value) {
	String[] names = StringUtils.split(key, "_");
	if (names.length != 2) {
		throw new IllegalArgumentException(key + " is not a valid search filter name");
	}
	String fieldName = names[0];
	String operator = StringUtils.upperCase(names[1]);
	String fieldValue = value;

	Triple<String, String, String> triple = Triple.of(fieldName, operator, fieldValue);
	return triple;
}
 
开发者ID:East196,项目名称:maker,代码行数:13,代码来源:SearchUtils.java

示例9: getDashboardPageConfiguration

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
public Triple<String, Boolean, List<DashboardRowConfiguration>> getDashboardPageConfiguration(Long dashboardPageId, String uid)
        throws DashboardException {
    if (log.isDebugEnabled()) {
        log.debug("Request for dashboard page " + dashboardPageId + " configuration for user " + (uid == null ? "current" : uid));
    }
    IUserAccount userAccount = getUserAccount(uid);
    String pageName = null;
    Boolean isHome = null;
    List<DashboardRowConfiguration> rows = null;
    Ebean.beginTransaction();
    try {
        DashboardPage dashboardPage = DashboardPage.find.where().eq("id", dashboardPageId).findUnique();
        if (dashboardPage == null || !userAccount.getUid().equals(dashboardPage.principal.uid)) {
            if (log.isDebugEnabled()) {
                log.debug("No page found for id " + dashboardPageId + " and user " + userAccount.getUid());
            }
            return null;
        }
        // Extract the data stored into the database
        try {
            rows = getMapper().readValue(dashboardPage.layout, new TypeReference<List<DashboardRowConfiguration>>() {
            });
            pageName = dashboardPage.name;
            isHome = dashboardPage.isHome;
        } catch (Exception exp) {
            log.error("Unable to read the content of the dashboard configuration from the database ", exp);
            throw exp;
        }
        Ebean.commitTransaction();
    } catch (Exception e) {
        Ebean.rollbackTransaction();
        String message = String.format("No dashboard configuration page for %d", dashboardPageId);
        log.error(message, e);
        throw new DashboardException(message, e);
    } finally {
        Ebean.endTransaction();
    }
    return Triple.of(pageName, isHome, rows);
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:41,代码来源:DashboardServiceImpl.java

示例10: svdDecompose

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
public static Triple<Quat4f, Vector3f, Quat4f> svdDecompose(Matrix3f m)
{
    // determine V by doing 5 steps of Jacobi iteration on MT * M
    Quat4f u = new Quat4f(0, 0, 0, 1), v = new Quat4f(0, 0, 0, 1), qt = new Quat4f();
    Matrix3f b = new Matrix3f(m), t = new Matrix3f();
    t.transpose(m);
    b.mul(t, b);

    for(int i = 0; i < 5; i++) v.mul(stepJacobi(b));

    v.normalize();
    t.set(v);
    b.set(m);
    b.mul(t);

    // FIXME: this doesn't work correctly for some reason; not crucial, so disabling for now; investigate in the future.
    //sortSingularValues(b, v);

    Pair<Float, Float> p;

    float ul = 1f;

    p = qrGivensQuat(b.m00, b.m10);
    qt.set(0, 0, p.getLeft(), p.getRight());
    u.mul(qt);
    t.setIdentity();
    t.m00 = qt.w * qt.w - qt.z * qt.z;
    t.m11 = t.m00;
    t.m10 = -2 * qt.z * qt.w;
    t.m01 = -t.m10;
    t.m22 = qt.w * qt.w + qt.z * qt.z;
    ul *= t.m22;
    b.mul(t, b);

    p = qrGivensQuat(b.m00, b.m20);
    qt.set(0, -p.getLeft(), 0, p.getRight());
    u.mul(qt);
    t.setIdentity();
    t.m00 = qt.w * qt.w - qt.y * qt.y;
    t.m22 = t.m00;
    t.m20 = 2 * qt.y * qt.w;
    t.m02 = -t.m20;
    t.m11 = qt.w * qt.w + qt.y * qt.y;
    ul *= t.m11;
    b.mul(t, b);

    p = qrGivensQuat(b.m11, b.m21);
    qt.set(p.getLeft(), 0, 0, p.getRight());
    u.mul(qt);
    t.setIdentity();
    t.m11 = qt.w * qt.w - qt.x * qt.x;
    t.m22 = t.m11;
    t.m21 = -2 * qt.x * qt.w;
    t.m12 = -t.m21;
    t.m00 = qt.w * qt.w + qt.x * qt.x;
    ul *= t.m00;
    b.mul(t, b);

    ul = 1f / ul;
    u.scale((float)Math.sqrt(ul));

    Vector3f s = new Vector3f(b.m00 * ul, b.m11 * ul, b.m22 * ul);

    return Triple.of(u, s, v);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:66,代码来源:TRSRTransformation.java

示例11: statsKey

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private Triple statsKey(PeriodParams pp) {
    return Triple.of(Pair.of(pp.getInterval().getStart().getMillis(), pp.getInterval().getEnd().getMillis()),
            pp.getAnalyseId(), pp.getJvmId());
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:5,代码来源:EventsController.java

示例12: getTrendData

import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
/**
 * Get the KPI data of the last 3 months for a trend.
 * 
 * @param objectId
 *            the object id
 */
public Triple<List<KpiData>, List<KpiData>, List<KpiData>> getTrendData(Long objectId) {
    return Triple.of(getKpiData(objectId, this.kpiDefinition.mainKpiValueDefinition),
            getKpiData(objectId, this.kpiDefinition.additional1KpiValueDefinition),
            getKpiData(objectId, this.kpiDefinition.additional2KpiValueDefinition));
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:12,代码来源:Kpi.java


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