• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NumberExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javafx.beans.binding.NumberExpression的典型用法代码示例。如果您正苦于以下问题:Java NumberExpression类的具体用法?Java NumberExpression怎么用?Java NumberExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NumberExpression类属于javafx.beans.binding包,在下文中一共展示了NumberExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addItem

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
public RadialItem addItem(MenuItem item) {

        final DoubleExpression idx = new SimpleDoubleProperty(items.size());
        final NumberExpression itemRange = new When(params.directionProperty().isEqualTo(Direction.CW))
                .then(idx.divide(itemsCount.subtract(1)))
                .otherwise(itemsCount.subtract(idx.add(1)).divide(itemsCount.subtract(1)));
        final DoubleExpression itemAngleDeg = correctedStreakAngleDeg.add(angularTotalSizeDeg.multiply(itemRange)).subtract(angularTotalSizeDeg.multiply(0.5));

        final RadialItem itemButton = new RadialItem(params, item.getGraphic(), item.getText(), this, itemAngleDeg,
                (parentSection != null) ? parentSection.nominalRadius : new SimpleDoubleProperty(0),
                (item instanceof Menu));

        items.add(itemButton);
        radialPane.getChildren().add(itemButton);

        return itemButton;
    }
 
开发者ID:dejv78,项目名称:jfx.radialmenu,代码行数:18,代码来源:RadialMenuSectionDynamic.java


示例2: calculate

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
@Override
protected double calculate() {
	double value = Double.MAX_VALUE;
	for (NumberExpression expression : expressions) {
		value = Math.min(value, expression.getValue().doubleValue());
	}
	return value;
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:9,代码来源:MinimumDoubleBinding.java


示例3: RangedDoubleBinding

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
/**
 * @param expressions
 *            the expressions we wish to perform an operation against
 */
public RangedDoubleBinding(Collection<NumberExpression> expressions) {
	super();
	this.expressions = FXCollections.observableArrayList(expressions);

	this.bind(expressions.toArray(new NumberExpression[expressions.size()]));
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:11,代码来源:RangedDoubleBinding.java


示例4: calculate

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
@Override
protected double calculate() {
	double value = 0;
	for(NumberExpression expression: expressions){
		value += expression.getValue().doubleValue();
	}
	return value;
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:9,代码来源:SumDoubleBinding.java


示例5: calculate

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
@Override
protected double calculate() {
	double value = 0;
	for(NumberExpression expression: expressions){
		value += expression.getValue().doubleValue();
	}
	return value / expressions.size();
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:9,代码来源:AverageDoubleBinding.java


示例6: calculate

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
@Override
protected double calculate() {
	double value = Double.MIN_VALUE;
	for(NumberExpression expression: expressions){
		double expressionValue = expression.doubleValue();
		value = Math.max(value, expressionValue);
	}
	return value;
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:10,代码来源:MaximumDoubleBinding.java


示例7: FibTest

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
private FibTest(int n) {
    N = n;
    fib = new NumberExpression[N];
    fib[0] = new SimpleLongProperty(0);
    fib[1] = new SimpleLongProperty(0);
    for(int i = 2; i < N; ++i) {
        fib[i] = fib[i-2].add(fib[i-1]);
    }
}
 
开发者ID:TomasMikula,项目名称:ReactFX,代码行数:10,代码来源:FibTest.java


示例8: createSteps

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
private NumberExpression createSteps(Step<?> step, int depth, int currentStateIndex, int selectedStateIndex, int firstStateIndex, int lastStateIndex,
			List<Path> accumulator, Object[] stepTargets) {

		final int stepStartingIndex = traceExtractor.getStateIndex(step.getStartingState());

		final boolean endedStep = step.getEndingState() != null;

		final int startingIndex = stepStartingIndex - currentStateIndex;
		final int endingIndex = (endedStep ? traceExtractor.getStateIndex(step.getEndingState())
				: nbStates.intValue()) - currentStateIndex;
		final Path path = new Path();
		path.setStrokeWidth(2);

		final double x1 = startingIndex * UNIT + UNIT / 2;
		final double x4 = endingIndex * UNIT + UNIT / 2;
		final double x2 = x1 + UNIT / 4;
		final double x3 = x4 - UNIT / 4;
		final double baseLineY = DIAMETER / 2 + V_MARGIN;
		final MoveTo moveTo = new MoveTo(x1, baseLineY);
		final LineTo lineTo = new LineTo(x2, baseLineY);
		final HLineTo hLineTo = new HLineTo(x3);
		path.getElements().addAll(moveTo, lineTo, hLineTo);
		if (endedStep) {
			final LineTo lastLineTo = new LineTo(x4, baseLineY);
			path.getElements().add(lastLineTo);
		}

		accumulator.add(path);

		final List<? extends Step<?>> subSteps = traceExtractor.getSubSteps(step);
		NumberExpression yOffset = new SimpleDoubleProperty(0);
		if (subSteps != null && !subSteps.isEmpty()) {
			for (Step<?> subStep : subSteps) {
				if (subStep.getStartingState() != subStep.getEndingState()
//						&& ((traceExtractor.getStateIndex(subStep.getEndingState()) < firstStateIndex) || traceExtractor.getStateIndex(subStep.getStartingState()) > lastStateIndex)
						) {
					yOffset = Bindings.max(yOffset, createSteps(subStep, depth + 1, currentStateIndex, selectedStateIndex, firstStateIndex, lastStateIndex, accumulator, stepTargets));
				}
			}
		}

		lineTo.yProperty().bind(yOffset.add(DIAMETER / 2 + V_MARGIN));

		if (stepTargets[CURRENT_FORWARD_STEP] == step) {
			path.setStroke(Color.DARKORANGE);
		} else if (stepTargets[CURRENT_BACKWARD_STEP] == step) {
			path.setStroke(Color.DARKGREEN);
		} else if (stepTargets[CURRENT_BIGSTEP] == step) {
			path.setStroke(Color.DARKRED);
		} else {
			path.setStroke(Color.DARKBLUE);
			if (!traceExplorer.getCallStack().contains(step) && (stepStartingIndex > selectedStateIndex
					|| (stepStartingIndex == selectedStateIndex && endedStep))) {
				path.getStrokeDashArray().addAll(5., 5.);
				path.setStrokeLineCap(StrokeLineCap.ROUND);
			}
		}

		return lineTo.yProperty();
	}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:61,代码来源:MultidimensionalTimelineRenderer.java


示例9: bindPercentage

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
private NumberBinding bindPercentage(final NumberExpression property, final NumberBinding total) {
    return Bindings.when(property.isEqualTo(0)).then(0).otherwise(property.multiply(PERCENT).divide(total));
}
 
开发者ID:VocabHunter,项目名称:VocabHunter,代码行数:4,代码来源:ProgressModel.java


示例10: generatePairingNodes

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
private List<Node> generatePairingNodes(List<List<Pairing>> pairings,
        NumberExpression xMin, NumberExpression yMin) {
    List<Node> nodes = new ArrayList<>();

    List<PairingNode> prevNodes = null;
    List<PairingNode> nextNodes = null;

    NumberExpression maxX = xMin;
    NumberExpression maxY = yMin;

    int r = 0;
    for (List<Pairing> round : pairings) {
        if (round.size() == 0) {
            continue;
        }
        NumberExpression currentMaxX = maxX;

        nextNodes = new ArrayList<>();
        PairingNode prevNode = null;
        int pairingId = 1;
        for (Pairing pairing : round) {
            PairingNode node = new PairingNode(this.loadedTournament,
                    pairing, pairingId++);

            if (prevNode == null) {
                node.layoutYProperty().bind(yMin);
            } else {
                node.layoutYProperty().bind(
                        prevNode.layoutYProperty()
                                .add(prevNode.heightProperty()).add(10));
            }

            node.layoutXProperty().bind(currentMaxX);
            nodes.add(node);
            nextNodes.add(node);

            maxX = Bindings.max(maxX,
                    node.layoutXProperty().add(node.widthProperty())
                            .add(50));
            maxY = Bindings.max(maxY,
                    node.layoutYProperty().add(node.heightProperty()));
            prevNode = node;
        }

        if (prevNodes != null && nextNodes.size() > 0) {
            this.createConnections(prevNodes, nextNodes, nodes);
        }
        prevNodes = nextNodes;

        maxX.add(50);
    }

    return nodes;
}
 
开发者ID:Novanoid,项目名称:Tourney,代码行数:55,代码来源:PairingView.java


示例11: createConnections

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
private void createConnections(List<PairingNode> previousPairings,
        List<PairingNode> nextPairings, List<Node> nodes) {
    Map<PairingNode, List<PairingNode>> precedingNodes = new HashMap<>();

    for (PairingNode prev : previousPairings) {
        Pairing prevPairing = prev.getPairing();
        for (Player prevPlayer : prevPairing.getOpponents()) {
            for (PairingNode next : nextPairings) {
                List<PairingNode> predecessors = precedingNodes.get(next);
                if (predecessors == null) {
                    predecessors = new ArrayList<>();
                    precedingNodes.put(next, predecessors);
                }
                Pairing nextPairing = next.getPairing();
                if (this.collectionContainsPlayer(
                        nextPairing.getOpponents(), prevPlayer)) {
                    predecessors.add(prev);
                    this.createConnection(prev, prevPlayer, next, nodes);
                    break;
                }
            }
        }
    }

    for (Entry<PairingNode, List<PairingNode>> entry : precedingNodes
            .entrySet()) {
        NumberExpression averageY = new SimpleDoubleProperty(0);

        for (PairingNode node : entry.getValue()) {
            averageY = averageY.add(node.layoutYProperty().add(
                    node.heightProperty().divide(2d)));
        }

        averageY = averageY.divide((double) entry.getValue().size());

        entry.getKey().layoutYProperty().unbind();
        entry.getKey()
                .layoutYProperty()
                .bind(averageY.subtract(entry.getKey().heightProperty()
                        .divide(2d)));
    }
}
 
开发者ID:Novanoid,项目名称:Tourney,代码行数:43,代码来源:PairingView.java


示例12: createConnection

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
private void createConnection(PairingNode previousNode,
        Player previousPlayer, PairingNode nextNode, List<Node> nodes) {

    Line horizontal1 = new Line();
    horizontal1.setFill(Color.TRANSPARENT);
    horizontal1.setStroke(Color.BLACK);
    horizontal1.setStrokeWidth(2);
    Line vertical = new Line();
    vertical.setFill(Color.TRANSPARENT);
    vertical.setStroke(Color.BLACK);
    vertical.setStrokeWidth(2);
    Line horizontal2 = new Line();
    horizontal2.setFill(Color.TRANSPARENT);
    horizontal2.setStroke(Color.BLACK);
    horizontal2.setStrokeWidth(2);

    NumberExpression left = new DoubleBinding() {
        {
            super.bind(previousNode.layoutXProperty(),
                    previousNode.widthProperty());
        }

        @Override
        protected double computeValue() {
            return previousNode.getLayoutX() + previousNode.getWidth();
        }
    };
    NumberExpression top = new DoubleBinding() {
        {
            super.bind(previousNode.layoutYProperty(),
                    previousNode.heightProperty());
        }

        @Override
        protected double computeValue() {
            return Math.floor(previousNode.getLayoutY()
                    + previousNode.getHeight() / 2d);
        }
    };
    NumberExpression bottom = new DoubleBinding() {
        {
            super.bind(nextNode.layoutYProperty(),
                    nextNode.heightProperty());
        }

        @Override
        protected double computeValue() {
            return Math.floor(nextNode.getLayoutY() + nextNode.getHeight()
                    / 2d);
        }
    };
    NumberExpression center = new DoubleBinding() {
        {
            super.bind(nextNode.layoutXProperty());
        }

        @Override
        protected double computeValue() {
            return Math.floor(nextNode.getLayoutX() - 25);
        }
    };

    horizontal1.startXProperty().bind(left);
    horizontal1.endXProperty().bind(center);
    horizontal1.startYProperty().bind(top);
    horizontal1.endYProperty().bind(top);

    vertical.startXProperty().bind(center);
    vertical.endXProperty().bind(center);
    vertical.startYProperty().bind(top);
    vertical.endYProperty().bind(bottom);

    horizontal2.startXProperty().bind(center);
    horizontal2.endXProperty().bind(nextNode.layoutXProperty());
    horizontal2.startYProperty().bind(bottom);
    horizontal2.endYProperty().bind(bottom);

    nodes.add(horizontal1);
    nodes.add(vertical);
    nodes.add(horizontal2);
}
 
开发者ID:Novanoid,项目名称:Tourney,代码行数:82,代码来源:PairingView.java


示例13: AbsoluteDoubleBinding

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
/**
 * @param expression the expression we wish to get the absoloute value of
 */
public AbsoluteDoubleBinding(NumberExpression expression) {
	super();
	this.expression = expression;
	this.bind(expression);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:9,代码来源:AbsoluteDoubleBinding.java


示例14: MinimumDoubleBinding

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
/**
 * @param expressions the expressions we want the smallest of
 */
public MinimumDoubleBinding(Collection<NumberExpression> expressions) {
	super(expressions);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:7,代码来源:MinimumDoubleBinding.java


示例15: addExpression

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
/**
 * Add an expression to be considered for calculation
 * @param expression
 */
public void addExpression(NumberExpression expression) {
	this.bind(expression);
	expressions.add(expression);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:9,代码来源:RangedDoubleBinding.java


示例16: removeExpression

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
/**
 * Remove an expression to be considered for calculation
 * @param expression
 */
public void removeExpression(NumberExpression expression) {
	this.unbind(expression);
	expressions.remove(expression);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:9,代码来源:RangedDoubleBinding.java


示例17: abs

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
public static AbsoluteDoubleBinding abs(NumberExpression expression) {
	return new AbsoluteDoubleBinding(expression);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:4,代码来源:PropertyMath.java


示例18: avg

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
public static AverageDoubleBinding avg(NumberExpression... expressions) {
	return new AverageDoubleBinding(expressions);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:4,代码来源:PropertyMath.java


示例19: max

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
public static MaximumDoubleBinding max(NumberExpression... expressions) {
	return new MaximumDoubleBinding(expressions);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:4,代码来源:PropertyMath.java


示例20: min

import javafx.beans.binding.NumberExpression; //导入依赖的package包/类
public static MinimumDoubleBinding min(NumberExpression... expressions) {
	return new MinimumDoubleBinding(expressions);
}
 
开发者ID:jackmoxley,项目名称:Moxy-Parser,代码行数:4,代码来源:PropertyMath.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CSSFactory类代码示例发布时间:2022-05-22
下一篇:
Java ConsoleErrorReporter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap