Java Code Examples for java.util.EnumSet#clone()
The following examples show how to use
java.util.EnumSet#clone() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Optimizer.java From buck with Apache License 2.0 | 6 votes |
/** * Runs the optimizer with a strategy to minimize the number of rop-form * registers used by the end result. Dex bytecode does not have instruction * forms that take register numbers larger than 15 for all instructions. * If we've produced a method that uses more than 16 registers, try again * with a different strategy to see if we can get under the bar. The end * result will be much more efficient. * * @param rmeth method to process * @param paramWidth the total width, in register-units, of this method's * parameters * @param isStatic true if this method has no 'this' pointer argument. * @param steps set of optional optimization steps to run * @return optimized method */ private static RopMethod optimizeMinimizeRegisters(RopMethod rmeth, int paramWidth, boolean isStatic, EnumSet<OptionalStep> steps) { SsaMethod ssaMeth; RopMethod resultMeth; ssaMeth = SsaConverter.convertToSsaMethod( rmeth, paramWidth, isStatic); EnumSet<OptionalStep> newSteps = steps.clone(); /* * CONST_COLLECTOR trades insns for registers, which is not an * appropriate strategy here. */ newSteps.remove(OptionalStep.CONST_COLLECTOR); runSsaFormSteps(ssaMeth, newSteps); resultMeth = SsaToRop.convertToRopMethod(ssaMeth, true); return resultMeth; }
Example 2
Source File: FlagOpTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 3
Source File: FlagOpTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 4
Source File: Optimizer.java From Box with Apache License 2.0 | 6 votes |
/** * Runs the optimizer with a strategy to minimize the number of rop-form * registers used by the end result. Dex bytecode does not have instruction * forms that take register numbers larger than 15 for all instructions. * If we've produced a method that uses more than 16 registers, try again * with a different strategy to see if we can get under the bar. The end * result will be much more efficient. * * @param rmeth method to process * @param paramWidth the total width, in register-units, of this method's * parameters * @param isStatic true if this method has no 'this' pointer argument. * @param steps set of optional optimization steps to run * @return optimized method */ private static RopMethod optimizeMinimizeRegisters(RopMethod rmeth, int paramWidth, boolean isStatic, EnumSet<OptionalStep> steps) { SsaMethod ssaMeth; RopMethod resultMeth; ssaMeth = SsaConverter.convertToSsaMethod( rmeth, paramWidth, isStatic); EnumSet<OptionalStep> newSteps = steps.clone(); /* * CONST_COLLECTOR trades insns for registers, which is not an * appropriate strategy here. */ newSteps.remove(OptionalStep.CONST_COLLECTOR); runSsaFormSteps(ssaMeth, newSteps); resultMeth = SsaToRop.convertToRopMethod(ssaMeth, true); return resultMeth; }
Example 5
Source File: FlagOpTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 6
Source File: Optimizer.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * Runs the optimizer with a strategy to minimize the number of rop-form * registers used by the end result. Dex bytecode does not have instruction * forms that take register numbers larger than 15 for all instructions. * If we've produced a method that uses more than 16 registers, try again * with a different strategy to see if we can get under the bar. The end * result will be much more efficient. * * @param rmeth method to process * @param paramWidth the total width, in register-units, of this method's * parameters * @param isStatic true if this method has no 'this' pointer argument. * @param steps set of optional optimization steps to run * @return optimized method */ private static RopMethod optimizeMinimizeRegisters(RopMethod rmeth, int paramWidth, boolean isStatic, EnumSet<OptionalStep> steps) { SsaMethod ssaMeth; RopMethod resultMeth; ssaMeth = SsaConverter.convertToSsaMethod( rmeth, paramWidth, isStatic); EnumSet<OptionalStep> newSteps = steps.clone(); /* * CONST_COLLECTOR trades insns for registers, which is not an * appropriate strategy here. */ newSteps.remove(OptionalStep.CONST_COLLECTOR); runSsaFormSteps(ssaMeth, newSteps); resultMeth = SsaToRop.convertToRopMethod(ssaMeth, true); return resultMeth; }
Example 7
Source File: FlagOpTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 8
Source File: FlagOpTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 9
Source File: FlagOpTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 10
Source File: FlagOpTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 11
Source File: Optimizer.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * Runs the optimizer with a strategy to minimize the number of rop-form * registers used by the end result. Dex bytecode does not have instruction * forms that take register numbers larger than 15 for all instructions. * If we've produced a method that uses more than 16 registers, try again * with a different strategy to see if we can get under the bar. The end * result will be much more efficient. * * @param rmeth method to process * @param paramWidth the total width, in register-units, of this method's * parameters * @param isStatic true if this method has no 'this' pointer argument. * @param steps set of optional optimization steps to run * @return optimized method */ private static RopMethod optimizeMinimizeRegisters(RopMethod rmeth, int paramWidth, boolean isStatic, EnumSet<OptionalStep> steps) { SsaMethod ssaMeth; RopMethod resultMeth; ssaMeth = SsaConverter.convertToSsaMethod( rmeth, paramWidth, isStatic); EnumSet<OptionalStep> newSteps = steps.clone(); /* * CONST_COLLECTOR trades insns for registers, which is not an * appropriate strategy here. */ newSteps.remove(OptionalStep.CONST_COLLECTOR); runSsaFormSteps(ssaMeth, newSteps); resultMeth = SsaToRop.convertToRopMethod(ssaMeth, true); return resultMeth; }
Example 12
Source File: FlagOpTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 13
Source File: FlagOpTest.java From streamsupport with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 14
Source File: FlagOpTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 15
Source File: FlagOpTest.java From hottub with GNU General Public License v2.0 | 6 votes |
public void testFlagsSizedOrderedParallelCollect() { EnumSet<StreamOpFlag> parKnown = EnumSet.of(StreamOpFlag.SIZED); EnumSet<StreamOpFlag> serKnown = parKnown.clone(); List<IntermediateTestOp<Integer, Integer>> ops = new ArrayList<>(); for (StreamOpFlag f : parKnown) { ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(f.clear(), parKnown, serKnown)); serKnown.remove(f); } ops.add(CollectorOps.collector()); ops.add(new ParSerTestFlagExpectedOp<>(0, parKnown, EnumSet.noneOf(StreamOpFlag.class))); TestData<Integer, Stream<Integer>> data = TestData.Factory.ofArray("Array", countTo(10).toArray(new Integer[0])); @SuppressWarnings("rawtypes") IntermediateTestOp[] opsArray = ops.toArray(new IntermediateTestOp[ops.size()]); withData(data).ops(opsArray).exercise(); }
Example 16
Source File: GemFireXDUtils.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static EnumSet<TransactionFlag> addTXFlag(TransactionFlag flag, EnumSet<TransactionFlag> flagSingleton, EnumSet<TransactionFlag> currentFlags) { if (currentFlags == null) { return flagSingleton; } // don't overwrite static single sized flags else if (currentFlags.size() == 1) { currentFlags = currentFlags.clone(); } currentFlags.add(flag); return currentFlags; }
Example 17
Source File: GemFireXDUtils.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static EnumSet<TransactionFlag> addTXFlag(TransactionFlag flag, EnumSet<TransactionFlag> flagSingleton, EnumSet<TransactionFlag> currentFlags) { if (currentFlags == null) { return flagSingleton; } // don't overwrite static single sized flags else if (currentFlags.size() == 1) { currentFlags = currentFlags.clone(); } currentFlags.add(flag); return currentFlags; }
Example 18
Source File: MIMEStream.java From domino-jna with Apache License 2.0 | 3 votes |
/** * Creates a MIME stream, serializes the named items into it, and returns the MIME stream.<br> * Specify the flag {@link MimeStreamOpenOptions#RFC2822_INCLUDE_HEADERS} * to flush all RFC2822 headers to the output MIME stream; i.e., * the message's initial headers -- To, From, Subject, Date, etc.<br> * <br> * Also specify the flag {@link MimeStreamOpenOptions#MIME_INCLUDE_HEADERS} * to flush all MIME entity headers to the output MIME stream. * * @param note note * @param itemName item name * @param flags open flags (e.g. whether to include RFC822 and headers) * @return MIME stream */ public static MIMEStream newStreamForRead(NotesNote note, String itemName, EnumSet<MimeStreamOpenOptions> flags) { EnumSet<MimeStreamOpenOptions> flagsClone = flags.clone(); int dwOpenFlags = MimeStreamOpenOptions.toBitMaskInt(flagsClone); dwOpenFlags = dwOpenFlags | NotesConstants.MIME_STREAM_OPEN_READ; return new MIMEStream(note, itemName, dwOpenFlags); }
Example 19
Source File: MIMEStream.java From domino-jna with Apache License 2.0 | 3 votes |
/** * Creates a MIME stream. Use {@link #putLine(String)} * or {@link #write(Reader)} to specify the MIME data to be written, then * call {@link #itemize(EnumSet)} to write the data to the document. * * @param note note * @param itemName mime item to write content * @param flags open flags * @return MIME stream */ public static MIMEStream newStreamForWrite(NotesNote note, String itemName, EnumSet<MimeStreamOpenOptions> flags) { EnumSet<MimeStreamOpenOptions> flagsClone = flags.clone(); int dwOpenFlags = MimeStreamOpenOptions.toBitMaskInt(flagsClone); dwOpenFlags = dwOpenFlags | NotesConstants.MIME_STREAM_OPEN_WRITE; return new MIMEStream(note, itemName, dwOpenFlags); }
Example 20
Source File: MdcInjectionFilter.java From neoscada with Eclipse Public License 1.0 | 2 votes |
/** * Use this constructor when you want to specify which keys to add to the MDC. * You could still add custom keys via {@link #setProperty(IoSession, String, String)} * @param keys set of keys that should be added to the MDC * * @see #setProperty(org.apache.mina.core.session.IoSession, String, String) */ public MdcInjectionFilter(EnumSet<MdcKey> keys) { this.mdcKeys = keys.clone(); }