當前位置: 首頁>>代碼示例>>Java>>正文


Java CacheUtil.cache方法代碼示例

本文整理匯總了Java中xdean.jex.util.cache.CacheUtil.cache方法的典型用法代碼示例。如果您正苦於以下問題:Java CacheUtil.cache方法的具體用法?Java CacheUtil.cache怎麽用?Java CacheUtil.cache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xdean.jex.util.cache.CacheUtil的用法示例。


在下文中一共展示了CacheUtil.cache方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTasks

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
public List<Function<String, Paint>> getTasks() {
  return CacheUtil.cache(CSSPaintPaser.class, () -> Arrays.asList(
      text -> Color.web(text, 1),
      text -> LinearGradient.valueOf(text),
      text -> RadialGradient.valueOf(text),
      text -> context.lookup(text),
      text -> DeriveColorConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      text -> LadderConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      text -> LinearGradientConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      text -> RadialGradientConverter.getInstance().convert(factory.apply(text), Font.getDefault())
      ));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:13,代碼來源:CSSPaintPaser.java

示例2: seriesTimeThen

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
/**
 * @param uniqueKey unique key
 * @param r the task
 * @param then (this time, total time) -&#62; {...}
 */
public static void seriesTimeThen(Object uniqueKey, Runnable r, BiConsumer<Long, Long> then) {
  Stopwatch total = CacheUtil.cache(TimingUtil.class, uniqueKey, () -> Stopwatch.createUnstarted());
  Stopwatch temp = getShareStopwatch();
  temp.reset();
  temp.start();
  total.start();
  r.run();
  temp.stop();
  total.stop();
  if (then != null) {
    then.accept(temp.elapsed(TimeUnit.MILLISECONDS), total.elapsed(TimeUnit.MILLISECONDS));
  }
}
 
開發者ID:XDean,項目名稱:Java-EX,代碼行數:19,代碼來源:TimingUtil.java

示例3: TabEntity

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
TabEntity() {
  this.tab = new Tab();
  this.manager = new CodeAreaManager(new CodeArea());
  this.codeArea = manager.getCodeArea();
  this.file = new SimpleObjectProperty<>();
  this.name = new SimpleStringProperty();
  this.icon = new FontAwesomeIconView();
  this.order = new SimpleIntegerProperty(nameOrder.next());

  init();

  CacheUtil.cache(MainFrameController.this, tab, () -> this);
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:14,代碼來源:MainFrameController.java

示例4: init

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
private void init() {
  // name
  name.bind(Bindings.when(file.isNull())
      .then(Bindings.createStringBinding(() -> "new" + order.get(), order))
      .otherwise(toStringBinding(map(file, f -> f.getName()))));

  // graphics
  tab.setGraphic(icon);
  icon.setStyleClass("tab-icon");
  icon.setIcon(FontAwesomeIcon.SAVE);
  // Hold the object in cache to avoid gc
  StringBinding state = CacheUtil.cache(this, "state",
      () -> Bindings.when(Bindings.equal(toObjectBinding(currentTabEntity()), this))
          .then(Bindings.when(manager.modifiedProperty())
              .then("selected-modified")
              .otherwise("selected"))
          .otherwise(Bindings.when(manager.modifiedProperty())
              .then("modified")
              .otherwise("")));
  state.addListener((ob, o, n) -> {
    uncatch(() -> icon.pseudoClassStateChanged(PseudoClass.getPseudoClass(o), false));
    uncatch(() -> icon.pseudoClassStateChanged(PseudoClass.getPseudoClass(n), true));
  });

  // recent
  file.addListener((ob, o, n) -> todoAll(
      () -> ifThat(n != null).todo(() -> recentSupport.setLastFile(n)),
      () -> ifThat(o == null && n != null).todo(() -> releaseName())
      ));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:31,代碼來源:MainFrameController.java

示例5: currentTabEntity

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
private ObservableValue<TabEntity> currentTabEntity() {
  return CacheUtil.cache(this, "currentTabEntity", () -> {
    ObjectProperty<TabEntity> op = new SimpleObjectProperty<>();
    op.bind(map(tabPane.getSelectionModel().selectedIndexProperty(),
        i -> uncatch(() -> tabList.get(i.intValue()))));
    return op;
  });
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:9,代碼來源:MainFrameController.java

示例6: currentCodeArea

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
private ObservableValue<CodeArea> currentCodeArea() {
  return CacheUtil.cache(this, "currentCodeArea", () -> {
    ObjectProperty<CodeArea> op = new SimpleObjectProperty<CodeArea>();
    op.bind(map(currentManager(), m -> uncatch(() -> m.getCodeArea())));
    return op;
  });
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:8,代碼來源:MainFrameController.java

示例7: getShareStopwatch

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
private static Stopwatch getShareStopwatch() {
  Stopwatch share = CacheUtil.cache(TimingUtil.class, Thread.currentThread(), () -> Stopwatch.createUnstarted());
  return share.isRunning() ? Stopwatch.createUnstarted() : share;
}
 
開發者ID:XDean,項目名稱:Java-EX,代碼行數:5,代碼來源:TimingUtil.java

示例8: getTasks

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
public List<Function<String, Border>> getTasks() {
  return CacheUtil.cache(CSSPaintPaser.class, () -> Arrays.asList(

      ));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:6,代碼來源:CSSBorderPaser.java

示例9: modifiedProperty

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
private ObservableValue<Boolean> modifiedProperty() {
  return CacheUtil.cache(this, "modified", () -> nestValue(currentManager(), m -> m.modifiedProperty()));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:4,代碼來源:MainFrameController.java

示例10: currentFile

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
private ObservableValue<File> currentFile() {
  return CacheUtil.cache(this, "currentFile", () -> nestValue(currentTabEntity(), t -> t.file));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:4,代碼來源:MainFrameController.java

示例11: currentManager

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
private ObservableValue<CodeAreaManager> currentManager() {
  return CacheUtil.cache(this, "currentManager", () -> map(currentTabEntity(), t -> t.manager));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:4,代碼來源:MainFrameController.java

示例12: getChildren

import xdean.jex.util.cache.CacheUtil; //導入方法依賴的package包/類
public List<Either<Option<?>, OptionGroup>> getChildren() {
  return CacheUtil.cache(this, () -> Collections.unmodifiableList(list));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:4,代碼來源:OptionGroup.java


注:本文中的xdean.jex.util.cache.CacheUtil.cache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。