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


Java Option.isSome方法代码示例

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


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

示例1: endDrag

import fj.data.Option; //导入方法依赖的package包/类
public void endDrag( final PullerNode pullerNode ) {
    blueKnots.append( redKnots ).foreach( _removeHighlight );
    Option<KnotNode> attachNode = getAttachNode( pullerNode );
    if ( attachNode.isSome() ) {
        Point2D hands = pullerNode.getGlobalAttachmentPoint();
        Point2D knot = attachNode.some().getGlobalFullBounds().getCenter2D();
        Vector2D delta = new Vector2D( hands, knot );
        Dimension2D localDelta = rootNode.globalToLocal( new Dimension2DDouble( delta.x, delta.y ) );
        pullerNode.animateToPositionScaleRotation( pullerNode.getOffset().getX() + localDelta.getWidth(), pullerNode.getOffset().getY() + localDelta.getHeight(), pullerNode.scale, 0,

                                                   //if the rope is moving, automatically translate to the right location otherwise the target will be puller arrives
                                                   mode.get() == Mode.GOING ? 0 : ANIMATION_DURATION );

        //attach everything
        attachNode.some().setPullerNode( pullerNode );
        pullerNode.setKnot( attachNode.some() );
        updateForceListeners();
    }
    else {
        detach( pullerNode );
        pullerNode.animateHome();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:24,代码来源:TugOfWarCanvas.java

示例2: animateSliceToBucket

import fj.data.Option; //导入方法依赖的package包/类
public PieSet animateSliceToBucket( CellPointer cell, long randomSeed ) {

        //Cell that should be moved
        //May choose a slice that is on its way to a pie
        final Slice prototype = sliceFactory.createPieCell( pies.length(), cell.container, cell.cell, denominator );
        final Option<Slice> sliceOption = slices.find( new F<Slice, Boolean>() {
            @Override public Boolean f( Slice m ) {
                return ( m.position.equals( prototype.position ) && m.angle == prototype.angle ) || m.movingToward( prototype );
            }
        } );

        final Slice slice = sliceOption.isSome() ? sliceOption.some() : slices.find( new F<Slice, Boolean>() {
            @Override public Boolean f( Slice s ) {
                return s.position.getY() == prototype.position.getY();
            }
        } ).some();

        //Could be none if still animating
        return animateSliceToBucket( slice, randomSeed );
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:PieSet.java

示例3: pick

import fj.data.Option; //导入方法依赖的package包/类
@Override protected Option<PickResult> pick( final Vector2D vector2D, final MockState mockState ) {
    for ( SNode sNode : children.reverse() ) {
        final Option<PickResult> picked = sNode.pick( vector2D, mockState );
        if ( picked.isSome() ) {
            return picked;
        }
    }
    return Option.none();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:SList.java

示例4: updatePickable

import fj.data.Option; //导入方法依赖的package包/类
private void updatePickable() {
    for ( T card : cards ) {
        card.setAllPickable( false );
    }
    final Option<T> front = getFrontCardInStack();
    if ( front.isSome() ) {
        front.some().setAllPickable( true );
        front.some().moveToFront();
    }
    moveNonStackCardsToFront();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:Stack.java

示例5: dragStarted

import fj.data.Option; //导入方法依赖的package包/类
@Override protected void dragStarted() {
    showShadow();
    final Option<Double> nextAngle = context.getNextAngle( this );
    if ( nextAngle.isSome() ) {
        animateToAngle( nextAngle.some() );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:PiePieceNode.java

示例6: intersectsAny

import fj.data.Option; //导入方法依赖的package包/类
private boolean intersectsAny( final Option<ForceArrowNode> other ) {
    return other.isSome() && getSign( forceInNewtons ) == getSign( other.some().forceInNewtons );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:ForceArrowNode.java

示例7: containsSite

import fj.data.Option; //导入方法依赖的package包/类
private boolean containsSite( int containerIndex ) {
    final Option<SingleContainerNode> containerNode = getSingleContainerNode( containerIndex );
    return containerNode.isSome() && containerNode.some().containsPiece();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:ContainerNode.java


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