conflict_resolution
stringlengths
27
16k
<<<<<<< class Function { //private final NonTerminalCall ntCall; //private Set<TermRewrites> terms; private Set<KList> terms = new HashSet<KList>(); //private boolean parses; private Function(Set<KList> terms) { this.terms = terms; } //public Function(NonTerminalCall ntCall, Term ) { this.ntCall = ntCall; } public static Function constant(Term term) { return new Function(new HashSet<KList>(Arrays.asList(new KList(Arrays.asList(term))))); } public static Function empty() { return new Function(new HashSet<KList>()); } public static Function identity() { return new Function(new HashSet<KList>(Arrays.asList(new KList()))); } public void addFunction(Function that) { this.terms.addAll(that.terms); } public boolean addFunctionComposition(Function sibling, Function child) { boolean result = false; for (KList x : sibling.terms) { for (KList y : child.terms) { KList z = x.shallowCopy(); z.getContents().addAll(y.getContents()); result |= this.terms.add(z); } } return result; } class Factoring { public final KList prefix; public final Term suffix; public Factoring(KList prefix, Term suffix) { this.prefix = prefix; this.suffix = suffix; } } Factoring factor(KList klist) { if (klist.getContents().size() == 0) { return null; } else { return new Factoring(new KList(klist.getContents().subList(0, klist.getContents().size()-1)), klist.getContents().get(klist.getContents().size()-1)); } } void addFactoredAndRunRule(Function that, StateReturn stateReturn) { // if lookahead, factors all results; always subjugates // this factoring will be wrong once we move to context sensitive functions, but it works for now //this.terms.append(new Ambiguity(KSorts.K, Arrays.asList(that.terms))); this.terms.addAll(stateReturn.key.stateCall.key.state.runRule(that.terms)); /* This code may be no longer useful. We discovered that factorings are unneeded (we think). //A more general algorithm would look roughly like the following: Set<KList> unfactorables = new HashSet<KList>(); HashMultimap<KList,Term> factorings = HashMultimap.create(); for (KList klist : that.terms) { Factoring factoring = factor(klist); if (factoring == null) { unfactorables.add(klist); } else { factorings.put(factoring.prefix, factoring.suffix); } } for (KList klist : unfactorables) { this.terms.add(stateReturn.key.stateCall.key.state.runRule(klist)); } for (Map.Entry<KList,Collection<Term>> entry : factorings.asMap().entrySet()) { KList klist = entry.getKey().shallowCopy(); klist.getContents().add(new Ambiguity(KSorts.K, new ArrayList<Term>(entry.getValue()))); // TODO: check result this.terms.add(stateReturn.key.stateCall.key.state.runRule(klist)); } */ } Set<KList> applyToNull() { return terms; } } ======= >>>>>>> <<<<<<< ======= /* >>>>>>> /* <<<<<<< Grammar.RegExState res1 = new Grammar.RegExState(new Grammar.StateId("RegExStid"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]"), null, "StartNt"); ======= RegExState res1 = new RegExState(new StateId("RegExStid"), nt1, new State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]")); >>>>>>> RegExState res1 = new RegExState(new StateId("RegExStid"), nt1, new State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]")); <<<<<<< Ambiguity result = new Ambiguity(KSorts.K, new ArrayList<Term>()); for(StateReturn stateReturn : s.getNtCall(new NonTerminalCall.Key(nt,0)).exitStateReturns) { ======= Ambiguity result = new Ambiguity("K", new ArrayList<Term>()); for(StateReturn stateReturn : s.getNtCall(new NonTerminalCall.Key(nt,position)).exitStateReturns) { >>>>>>> Ambiguity result = new Ambiguity("K", new ArrayList<Term>()); for(StateReturn stateReturn : s.getNtCall(new NonTerminalCall.Key(nt,position)).exitStateReturns) {
<<<<<<< // Copyright (C) 2014 K Team. All Rights Reserved. ======= // Copyright (C) 2012-2014 K Team. All Rights Reserved. >>>>>>> // Copyright (C) 2014 K Team. All Rights Reserved. <<<<<<< import org.kframework.parser.concrete2.KSyntax2GrammarStatesFilter; import org.kframework.utils.BinaryLoader; ======= import org.kframework.kompile.KompileOptions.Backend; >>>>>>> import org.kframework.kompile.KompileOptions.Backend; import org.kframework.parser.concrete2.KSyntax2GrammarStatesFilter; import org.kframework.utils.BinaryLoader;
<<<<<<< import scala.collection.immutable.Seq; import scala.collection.Set; ======= import scala.collection.immutable.Set; >>>>>>> import scala.collection.Set;
<<<<<<< public boolean isPattern() { return false; } @Override public int computeHash() { ======= protected final int computeHash() { >>>>>>> public boolean isPattern() { return false; } @Override protected final int computeHash() {
<<<<<<< if (!rule.getAttribute(JavaBackendRuleData.class).isCompiledForFastRewriting()) { if (((Rewrite) rule.getBody()).getRight() instanceof Cell) { Cell rhs = (Cell) ((Rewrite) rule.getBody()).getRight(); rule = rule.shallowCopy(); if (hasGroundCell(rhs)) { rule.getAttribute(JavaBackendRuleData.class).setCellsToCopy(Collections.singleton(rhs.getLabel())); } else { rule.getAttribute(JavaBackendRuleData.class).setCellsToCopy(Collections.<String>emptySet()); } } return rule; ======= if (!rule.isCompiledForFastRewriting()) { return setCellsToCopyForUncompiledRule(rule); >>>>>>> if (!rule.getAttribute(JavaBackendRuleData.class).isCompiledForFastRewriting()) { return setCellsToCopyForUncompiledRule(rule); <<<<<<< rule.getAttribute(JavaBackendRuleData.class).setCompiledForFastRewriting(false); ======= rule.setCompiledForFastRewriting(false); rule = setCellsToCopyForUncompiledRule(rule); >>>>>>> rule.getAttribute(JavaBackendRuleData.class).setCompiledForFastRewriting(false); rule = setCellsToCopyForUncompiledRule(rule);
<<<<<<< TermContext termContext = TermContext.builder(rewritingContext).freshCounter(initCounterValue).build(); KOREtoBackendKIL converter = new KOREtoBackendKIL(module, definition, termContext, true, false); Term backendKil = KILtoBackendJavaKILTransformer.expandAndEvaluate(termContext, kem, converter.convert(k)); JavaKRunState result = (JavaKRunState) rewriter.rewrite(new ConstrainedTerm(backendKil, termContext), depth.orElse(-1)); ======= KOREtoBackendKIL converter = new KOREtoBackendKIL(module, definition, TermContext.of(rewritingContext), false, false); Term backendKil = KILtoBackendJavaKILTransformer.expandAndEvaluate(rewritingContext, kem, converter.convert(k)); JavaKRunState result = (JavaKRunState) rewriter.rewrite(new ConstrainedTerm(backendKil, TermContext.of(rewritingContext, backendKil, BigInteger.ZERO)), depth.orElse(-1)); >>>>>>> TermContext termContext = TermContext.builder(rewritingContext).freshCounter(initCounterValue).build(); KOREtoBackendKIL converter = new KOREtoBackendKIL(module, definition, termContext, false, false); Term backendKil = KILtoBackendJavaKILTransformer.expandAndEvaluate(termContext, kem, converter.convert(k)); JavaKRunState result = (JavaKRunState) rewriter.rewrite(new ConstrainedTerm(backendKil, termContext), depth.orElse(-1)); <<<<<<< Definition evaluatedDef = KILtoBackendJavaKILTransformer.expandAndEvaluate(termContext, kem); evaluatedDef.setIndex(new IndexingTable(() -> evaluatedDef, new IndexingTable.Data())); cache.put(module, evaluatedDef); return evaluatedDef; ======= definition.setIndex(new IndexingTable(() -> definition, new IndexingTable.Data())); cache.put(module, definition); return definition; >>>>>>> definition.setIndex(new IndexingTable(() -> definition, new IndexingTable.Data())); cache.put(module, definition); return definition;
<<<<<<< public List<? extends Map<? extends KVariable, ? extends K>> search(K initialConfiguration, Optional<Integer> depth, Optional<Integer> bound, Rule pattern, SearchType searchType) { ======= public List<K> prove(List<Rule> rules) { throw new UnsupportedOperationException(); } @Override public List<? extends Map<? extends KVariable, ? extends K>> search(K initialConfiguration, Optional<Integer> depth, Optional<Integer> bound, Rule pattern) { >>>>>>> public List<? extends Map<? extends KVariable, ? extends K>> search(K initialConfiguration, Optional<Integer> depth, Optional<Integer> bound, Rule pattern, SearchType searchType) { throw new UnsupportedOperationException(); } @Override public List<K> prove(List<Rule> rules) {
<<<<<<< import org.kframework.kil.Production; import org.kframework.krun.K; ======= import org.kframework.utils.options.SMTSolver; >>>>>>> import org.kframework.kil.Production; import org.kframework.krun.K; import org.kframework.utils.options.SMTSolver; <<<<<<< if (leftHandSide instanceof Variable && rightHandSide instanceof org.kframework.backend.java.kil.Collection && ((org.kframework.backend.java.kil.Collection) rightHandSide).hasFrame() && ((org.kframework.backend.java.kil.Collection) rightHandSide).size() != 0 && leftHandSide.equals(((org.kframework.backend.java.kil.Collection) rightHandSide).frame())) { return true; } else if (rightHandSide instanceof Variable && leftHandSide instanceof org.kframework.backend.java.kil.Collection && ((org.kframework.backend.java.kil.Collection) leftHandSide).hasFrame() && ((org.kframework.backend.java.kil.Collection) leftHandSide).size() != 0 && rightHandSide.equals(((org.kframework.backend.java.kil.Collection) leftHandSide).frame())) { return true; } if (!K.do_testgen) { if (leftHandSide instanceof KItem) { } ======= if (!termContext().definition().context().javaExecutionOptions.generateTests) { >>>>>>> if (leftHandSide instanceof Variable && rightHandSide instanceof org.kframework.backend.java.kil.Collection && ((org.kframework.backend.java.kil.Collection) rightHandSide).hasFrame() && ((org.kframework.backend.java.kil.Collection) rightHandSide).size() != 0 && leftHandSide.equals(((org.kframework.backend.java.kil.Collection) rightHandSide).frame())) { return true; } else if (rightHandSide instanceof Variable && leftHandSide instanceof org.kframework.backend.java.kil.Collection && ((org.kframework.backend.java.kil.Collection) leftHandSide).hasFrame() && ((org.kframework.backend.java.kil.Collection) leftHandSide).size() != 0 && rightHandSide.equals(((org.kframework.backend.java.kil.Collection) leftHandSide).frame())) { return true; } if (!termContext().definition().context().javaExecutionOptions.generateTests) { <<<<<<< if (leftHandSide instanceof Variable && rightHandSide instanceof KItem && ((KItem) rightHandSide).kLabel() instanceof KLabelConstant && ((KLabelConstant) ((KItem) rightHandSide).kLabel()).isConstructor()) { boolean flag = false; for (Production production : definition.context().productionsOf(((KLabelConstant) ((KItem) rightHandSide).kLabel()).label())) { if (definition.context().isSubsortedEq(leftHandSide.sort(), production.getSort())) { flag = true; } } if (!flag) { return true; } } if (rightHandSide instanceof Variable && leftHandSide instanceof KItem && ((KItem) leftHandSide).kLabel() instanceof KLabelConstant && ((KLabelConstant) ((KItem) leftHandSide).kLabel()).isConstructor()) { boolean flag = false; for (Production production : definition.context().productionsOf(((KLabelConstant) ((KItem) leftHandSide).kLabel()).label())) { if (definition.context().isSubsortedEq(rightHandSide.sort(), production.getSort())) { flag = true; } } if (!flag) { return true; } } return !definition.context().hasCommonSubsort( ======= return !definition.subsorts().hasCommonSubsort( >>>>>>> if (leftHandSide instanceof Variable && rightHandSide instanceof KItem && ((KItem) rightHandSide).kLabel() instanceof KLabelConstant && ((KLabelConstant) ((KItem) rightHandSide).kLabel()).isConstructor()) { boolean flag = false; for (Production production : definition.context().productionsOf(((KLabelConstant) ((KItem) rightHandSide).kLabel()).label())) { if (definition.context().isSubsortedEq(leftHandSide.sort(), production.getSort())) { flag = true; } } if (!flag) { return true; } } if (rightHandSide instanceof Variable && leftHandSide instanceof KItem && ((KItem) leftHandSide).kLabel() instanceof KLabelConstant && ((KLabelConstant) ((KItem) leftHandSide).kLabel()).isConstructor()) { boolean flag = false; for (Production production : definition.context().productionsOf(((KLabelConstant) ((KItem) leftHandSide).kLabel()).label())) { if (definition.context().isSubsortedEq(rightHandSide.sort(), production.getSort())) { flag = true; } } if (!flag) { return true; } } return !definition.subsorts().hasCommonSubsort(
<<<<<<< import org.kframework.attributes.Location; import org.kframework.definition.Production; ======= import com.beust.jcommander.internal.Lists; import org.kframework.kore.outer.Production; >>>>>>> import com.beust.jcommander.internal.Lists; import org.kframework.attributes.Location; import org.kframework.definition.Production;
<<<<<<< out = new TreeCleanerVisitor(context).visitNode(out); if (context.globalOptions.verbose) // TODO(Radu): temporary for testing. Remove once we have something like --debug ======= out = out.accept(new TreeCleanerVisitor(context)); if (context.globalOptions.debug) >>>>>>> out = new TreeCleanerVisitor(context).visitNode(out); if (context.globalOptions.debug)
<<<<<<< ======= import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; >>>>>>> <<<<<<< import org.kframework.backend.java.symbolic.BuiltinFunction; ======= import org.kframework.backend.java.symbolic.CopyOnShareSubstAndEvalTransformer; >>>>>>> <<<<<<< import org.kframework.backend.java.symbolic.SymbolicConstraint; import org.kframework.backend.java.symbolic.SymbolicRewriter; ======= >>>>>>> import org.kframework.backend.java.symbolic.SymbolicConstraint; import org.kframework.backend.java.symbolic.SymbolicRewriter; <<<<<<< import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; ======= import com.google.common.collect.HashBasedTable; >>>>>>> import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import com.google.common.collect.HashBasedTable; import com.google.common.collect.ImmutableList; <<<<<<< Definition definition = termContext.definition(); // TODO(AndreiS): remove defensive coding kList = KCollection.upKind(kList, Kind.KLIST); KItem listTerminator = LIST_TERMINATORS.get(kLabel); if (listTerminator != null) { assert kList.equals(KList.EMPTY); return listTerminator; } ======= // TODO(AndreiS): remove defensive coding kList = KCollection.upKind(kList, Kind.KLIST); >>>>>>> // TODO(AndreiS): remove defensive coding kList = KCollection.upKind(kList, Kind.KLIST); <<<<<<< public Term expandPattern(SymbolicConstraint constraint, boolean narrowing, TermContext context) { if (constraint == null) { return this; } if (!(kLabel instanceof KLabelConstant && ((KLabelConstant) kLabel).isPattern() && kList instanceof KList)) { return this; } KLabelConstant kLabel = (KLabelConstant) kLabel(); KList kList = (KList) kList(); List<ConstrainedTerm> results = new ArrayList<>(); KList inputKList = new KList(getPatternInput()); KList outputKList = new KList(getPatternOutput()); for (Rule rule : context.definition().patternRules().get(kLabel)) { KList ruleInputKList = new KList(((KItem) rule.leftHandSide()).getPatternInput()); KList ruleOutputKList = new KList(((KItem) rule.leftHandSide()).getPatternOutput()); SymbolicConstraint unificationConstraint = new SymbolicConstraint(context); unificationConstraint.add(inputKList, ruleInputKList); unificationConstraint.simplify(); // TODO(AndreiS): there is only one solution here, so no list of constraints if (unificationConstraint.isFalse()) { continue; } if (narrowing) { SymbolicConstraint globalConstraint = new SymbolicConstraint(context); for (SymbolicConstraint.Equality equality : constraint.equalities()) { globalConstraint.add(equality.leftHandSide(), equality.rightHandSide()); } globalConstraint.addAll(unificationConstraint); globalConstraint.addAll(rule.requires()); globalConstraint.simplify(); if (globalConstraint.isFalse() || globalConstraint.checkUnsat()) { continue; } } else { if (!unificationConstraint.isMatching(ruleInputKList.variableSet())) { continue; } SymbolicConstraint requires = new SymbolicConstraint(context); requires.addAll(rule.requires()); requires.addAll(unificationConstraint); requires.simplify(); requires.orientSubstitution(ruleInputKList.variableSet()); if (!constraint.implies(requires, ruleInputKList.variableSet())) { continue; } } unificationConstraint.add(outputKList, ruleOutputKList); unificationConstraint.addAll(rule.ensures()); unificationConstraint.simplify(); results.add(SymbolicRewriter.constructNewSubjectTerm( rule, unificationConstraint, variableSet())); } if (results.size() == 1) { constraint.addAll(results.get(0).constraint()); return results.get(0).term(); } else { return this; } } public ImmutableList<Term> getPatternInput() { assert kLabel instanceof KLabelConstant && ((KLabelConstant) kLabel).isPattern() && kList instanceof KList; int inputCount = Integer.parseInt( ((KLabelConstant) kLabel).productions().get(0).getAttribute(Attribute.PATTERN_KEY)); return ImmutableList.copyOf(((KList) kList).getContents()).subList(0, inputCount); } public ImmutableList<Term> getPatternOutput() { assert kLabel instanceof KLabelConstant && ((KLabelConstant) kLabel).isPattern() && kList instanceof KList; int inputCount = Integer.parseInt( ((KLabelConstant) kLabel).productions().get(0).getAttribute(Attribute.PATTERN_KEY)); return ImmutableList.copyOf(((KList) kList).getContents()) .subList(inputCount, ((KList) kList).getContents().size()); } ======= /** * The sort information of this {@code KItem}, namely {@link KItem#sort} and * {@link KItem#isExactSort}, depends only on the {@code KLabelConstant} and * the sorts of its children. */ private static final class CacheTableColKey { final KLabelConstant kLabelConstant; final Sort[] sorts; final boolean[] bools; final int hashCode; public CacheTableColKey(KLabelConstant kLabelConstant, KList kList) { this.kLabelConstant = kLabelConstant; sorts = new Sort[kList.size()]; bools = new boolean[kList.size()]; int idx = 0; for (Term term : kList) { if (term instanceof KItem){ KItem kItem = (KItem) term; if (kItem.kLabel instanceof KLabelInjection) { term = ((KLabelInjection) kItem.kLabel).term(); } } sorts[idx] = term.sort(); bools[idx] = term.isExactSort(); idx++; } hashCode = computeHash(); } private int computeHash() { int hashCode = 1; hashCode = hashCode * Utils.HASH_PRIME + kLabelConstant.hashCode(); hashCode = hashCode * Utils.HASH_PRIME + Arrays.deepHashCode(sorts); hashCode = hashCode * Utils.HASH_PRIME + Arrays.hashCode(bools); return hashCode; } @Override public int hashCode() { return hashCode; } @Override public boolean equals(Object object) { if (!(object instanceof CacheTableColKey)) { return false; } CacheTableColKey key = (CacheTableColKey) object; return kLabelConstant.equals(key.kLabelConstant) && Arrays.deepEquals(sorts, key.sorts) && Arrays.equals(bools, key.bools); } } private static final class CacheTableValue { final Sort sort; final boolean isExactSort; CacheTableValue(Sort sort, boolean isExactSort) { this.sort = sort; this.isExactSort = isExactSort; } } >>>>>>> public Term expandPattern(SymbolicConstraint constraint, boolean narrowing, TermContext context) { if (constraint == null) { return this; } if (!(kLabel instanceof KLabelConstant && ((KLabelConstant) kLabel).isPattern() && kList instanceof KList)) { return this; } KLabelConstant kLabel = (KLabelConstant) kLabel(); KList kList = (KList) kList(); List<ConstrainedTerm> results = new ArrayList<>(); KList inputKList = new KList(getPatternInput()); KList outputKList = new KList(getPatternOutput()); for (Rule rule : context.definition().patternRules().get(kLabel)) { KList ruleInputKList = new KList(((KItem) rule.leftHandSide()).getPatternInput()); KList ruleOutputKList = new KList(((KItem) rule.leftHandSide()).getPatternOutput()); SymbolicConstraint unificationConstraint = new SymbolicConstraint(context); unificationConstraint.add(inputKList, ruleInputKList); unificationConstraint.simplify(); // TODO(AndreiS): there is only one solution here, so no list of constraints if (unificationConstraint.isFalse()) { continue; } if (narrowing) { SymbolicConstraint globalConstraint = new SymbolicConstraint(context); for (SymbolicConstraint.Equality equality : constraint.equalities()) { globalConstraint.add(equality.leftHandSide(), equality.rightHandSide()); } globalConstraint.addAll(unificationConstraint); globalConstraint.addAll(rule.requires()); globalConstraint.simplify(); if (globalConstraint.isFalse() || globalConstraint.checkUnsat()) { continue; } } else { if (!unificationConstraint.isMatching(ruleInputKList.variableSet())) { continue; } SymbolicConstraint requires = new SymbolicConstraint(context); requires.addAll(rule.requires()); requires.addAll(unificationConstraint); requires.simplify(); requires.orientSubstitution(ruleInputKList.variableSet()); if (!constraint.implies(requires, ruleInputKList.variableSet())) { continue; } } unificationConstraint.add(outputKList, ruleOutputKList); unificationConstraint.addAll(rule.ensures()); unificationConstraint.simplify(); results.add(SymbolicRewriter.constructNewSubjectTerm( rule, unificationConstraint, variableSet())); } if (results.size() == 1) { constraint.addAll(results.get(0).constraint()); return results.get(0).term(); } else { return this; } } public ImmutableList<Term> getPatternInput() { assert kLabel instanceof KLabelConstant && ((KLabelConstant) kLabel).isPattern() && kList instanceof KList; int inputCount = Integer.parseInt( ((KLabelConstant) kLabel).productions().get(0).getAttribute(Attribute.PATTERN_KEY)); return ImmutableList.copyOf(((KList) kList).getContents()).subList(0, inputCount); } public ImmutableList<Term> getPatternOutput() { assert kLabel instanceof KLabelConstant && ((KLabelConstant) kLabel).isPattern() && kList instanceof KList; int inputCount = Integer.parseInt( ((KLabelConstant) kLabel).productions().get(0).getAttribute(Attribute.PATTERN_KEY)); return ImmutableList.copyOf(((KList) kList).getContents()) .subList(inputCount, ((KList) kList).getContents().size()); } /** * The sort information of this {@code KItem}, namely {@link KItem#sort} and * {@link KItem#isExactSort}, depends only on the {@code KLabelConstant} and * the sorts of its children. */ private static final class CacheTableColKey { final KLabelConstant kLabelConstant; final Sort[] sorts; final boolean[] bools; final int hashCode; public CacheTableColKey(KLabelConstant kLabelConstant, KList kList) { this.kLabelConstant = kLabelConstant; sorts = new Sort[kList.size()]; bools = new boolean[kList.size()]; int idx = 0; for (Term term : kList) { if (term instanceof KItem){ KItem kItem = (KItem) term; if (kItem.kLabel instanceof KLabelInjection) { term = ((KLabelInjection) kItem.kLabel).term(); } } sorts[idx] = term.sort(); bools[idx] = term.isExactSort(); idx++; } hashCode = computeHash(); } private int computeHash() { int hashCode = 1; hashCode = hashCode * Utils.HASH_PRIME + kLabelConstant.hashCode(); hashCode = hashCode * Utils.HASH_PRIME + Arrays.deepHashCode(sorts); hashCode = hashCode * Utils.HASH_PRIME + Arrays.hashCode(bools); return hashCode; } @Override public int hashCode() { return hashCode; } @Override public boolean equals(Object object) { if (!(object instanceof CacheTableColKey)) { return false; } CacheTableColKey key = (CacheTableColKey) object; return kLabelConstant.equals(key.kLabelConstant) && Arrays.deepEquals(sorts, key.sorts) && Arrays.equals(bools, key.bools); } } private static final class CacheTableValue { final Sort sort; final boolean isExactSort; CacheTableValue(Sort sort, boolean isExactSort) { this.sort = sort; this.isExactSort = isExactSort; } }
<<<<<<< final Variable var = Variable.getFreshVar(sort); MaudeFilter filter = new MaudeFilter(); filter.visit(var); ======= final Variable var = MetaK.getFreshVar(sort); MaudeFilter filter = new MaudeFilter(definitionHelper); filter.visit(KApp.of(definitionHelper, new KInjectedLabel(var))); >>>>>>> final Variable var = Variable.getFreshVar(sort); MaudeFilter filter = new MaudeFilter(definitionHelper); filter.visit(var);
<<<<<<< msg += " Use attribute 'onlyLabel' or 'notInRules' and 'notInGround' paired with 'klabel(...)' to limit the use to programs."; GlobalSettings.kem.register(new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.COMPILER, msg, getName(), node.getFilename(), node.getLocation())); ======= msg += " Use attribute 'onlyLabel' paired with 'klabel(...)' to limit the use to programs."; GlobalSettings.kem.registerCompilerError(msg, this, node); >>>>>>> msg += " Use attribute 'onlyLabel' or 'notInRules' and 'notInGround' paired with 'klabel(...)' to limit the use to programs."; GlobalSettings.kem.registerCompilerError(msg, this, node);
<<<<<<< private final Multimap<KLabelConstant, Rule> anywhereRules = HashMultimap.create(); ======= private final Multimap<KLabelConstant, Rule> patternRules = ArrayListMultimap.create(); >>>>>>> private final Multimap<KLabelConstant, Rule> anywhereRules = HashMultimap.create(); private final Multimap<KLabelConstant, Rule> patternRules = ArrayListMultimap.create();
<<<<<<< assert false : "dead code"; if (MetaK.isComputationSort(node.getSort())) ======= if (MetaK.isComputationSort(node.getSort(definitionHelper))) >>>>>>> assert false : "dead code"; if (MetaK.isComputationSort(node.getSort(definitionHelper))) <<<<<<< assert false : "deprecated class"; return null; ======= String l = cst.getLocation(); String f = cst.getFilename(); if (!MetaK.isBuiltinSort(cst.getSort(definitionHelper))) { KList list = new KList(); list.add(StringBuiltin.of(cst.getSort(definitionHelper))); list.add(StringBuiltin.of(StringUtil.escape(cst.getValue()))); return new KApp(KLabelConstant.of("#token", definitionHelper), list).accept(this); } else { return new KApp(l, f, new KInjectedLabel(cst), KList.EMPTY); } } @Override public ASTNode transform(Builtin builtin) throws TransformerException { String l = builtin.getLocation(); String f = builtin.getFilename(); return new KApp(l, f, new KInjectedLabel(builtin), KList.EMPTY); >>>>>>> assert false : "deprecated class"; return null; /* String l = cst.getLocation(); String f = cst.getFilename(); if (!MetaK.isBuiltinSort(cst.getSort(definitionHelper))) { KList list = new KList(); list.add(StringBuiltin.of(cst.getSort(definitionHelper))); list.add(StringBuiltin.of(StringUtil.escape(cst.getValue()))); return new KApp(KLabelConstant.of("#token", definitionHelper), list).accept(this); } else { return new KApp(l, f, new KInjectedLabel(cst), KList.EMPTY); } */ <<<<<<< if (node.getSort().equals(KSorts.KITEM) || node.getSort().equals(KSorts.K)) { ======= if (node.getSort(definitionHelper).equals(KSorts.KITEM) || node.getSort(definitionHelper).equals(KSorts.K)) >>>>>>> if (node.getSort(definitionHelper).equals(KSorts.KITEM) || node.getSort(definitionHelper).equals(KSorts.K)) { <<<<<<< } if (MetaK.isKSort(node.getSort())) { return KApp.of(new KInjectedLabel(node)); } if (node.getSort().equals(BoolBuiltin.SORT_NAME) || node.getSort().equals(IntBuiltin.SORT_NAME) || node.getSort().equals(FloatBuiltin.SORT_NAME) || node.getSort().equals(StringBuiltin.SORT_NAME)) { return node; } ======= if (MetaK.isKSort(node.getSort(definitionHelper)) || MetaK.isBuiltinSort(node.getSort(definitionHelper))) return KApp.of(definitionHelper, new KInjectedLabel(node)); >>>>>>> } if (MetaK.isKSort(node.getSort(definitionHelper))) return KApp.of(definitionHelper, new KInjectedLabel(node)); } if (node.getSort().equals(BoolBuiltin.SORT_NAME) || node.getSort().equals(IntBuiltin.SORT_NAME) || node.getSort().equals(FloatBuiltin.SORT_NAME) || node.getSort().equals(StringBuiltin.SORT_NAME)) { return node; }
<<<<<<< private Map<String, Sort> cellSorts = new HashMap<>(); public Map<Sort, Production> listConses = new HashMap<>(); public Map<String, Set<String>> listLabels = new HashMap<String, Set<String>>(); ======= public Map<String, Sort> cellKinds = new HashMap<>(); public Map<String, Sort> cellSorts = new HashMap<>(); public Map<Sort, Production> listProductions = new HashMap<>(); public SetMultimap<String, Production> listKLabels = HashMultimap.create(); >>>>>>> public Map<String, Sort> cellSorts = new HashMap<>(); public Map<Sort, Production> listProductions = new HashMap<>(); public SetMultimap<String, Production> listKLabels = HashMultimap.create();
<<<<<<< return cache.get(Pair.of(definition.signaturesOf(label), definition.kLabelAttributesOf(label)), () -> new MapCache<>(new PatriciaTrie<>())) .get(label, () -> new KLabelConstant( label, incrementCacheSize(), definition.signaturesOf(label), ======= return cache.computeIfAbsent(Pair.of(definition.signaturesOf(label), definition.kLabelAttributesOf(label)), p -> Collections.synchronizedMap(new PatriciaTrie<>())) .computeIfAbsent(label, l -> new KLabelConstant( l, definition.signaturesOf(l), >>>>>>> return cache.computeIfAbsent(Pair.of(definition.signaturesOf(label), definition.kLabelAttributesOf(label)), p -> Collections.synchronizedMap(new PatriciaTrie<>())) .computeIfAbsent(label, l -> new KLabelConstant( l, incrementCacheSize(), definition.signaturesOf(l),
<<<<<<< import org.kframework.krun.api.KRun; import org.kframework.krun.api.KRunDebugger; import org.kframework.krun.api.KRunProofResult; import org.kframework.krun.api.KRunResult; import org.kframework.krun.api.KRunState; import org.kframework.krun.api.SearchResult; import org.kframework.krun.api.SearchResults; import org.kframework.krun.api.SearchType; import org.kframework.krun.api.TestGenResult; import org.kframework.krun.api.TestGenResults; import org.kframework.krun.api.Transition; import org.kframework.krun.api.UnsupportedBackendOptionException; ======= import org.kframework.krun.KRunOptions.OutputMode; import org.kframework.krun.api.*; >>>>>>> import org.kframework.krun.KRunOptions.OutputMode; import org.kframework.krun.api.KRun; import org.kframework.krun.api.KRunDebugger; import org.kframework.krun.api.KRunProofResult; import org.kframework.krun.api.KRunResult; import org.kframework.krun.api.KRunState; import org.kframework.krun.api.SearchResult; import org.kframework.krun.api.SearchResults; import org.kframework.krun.api.SearchType; import org.kframework.krun.api.TestGenResult; import org.kframework.krun.api.TestGenResults; import org.kframework.krun.api.Transition; import org.kframework.krun.api.UnsupportedBackendOptionException;
<<<<<<< import org.kframework.parser.basic.Basic; import org.kframework.parser.basic.ParseException; ======= import org.kframework.parser.outer.Outer; import org.kframework.parser.outer.ParseException; import org.kframework.utils.errorsystem.KException; import org.kframework.utils.errorsystem.KException.ExceptionType; import org.kframework.utils.errorsystem.KException.KExceptionGroup; >>>>>>> import org.kframework.parser.outer.Outer; import org.kframework.parser.outer.ParseException; <<<<<<< strictAttrs = Basic.parseAttributes(attribute, prod.getSource()); ======= strictAttrs = Outer.parseAttributes(attribute, prod.getFilename()); >>>>>>> strictAttrs = Outer.parseAttributes(attribute, prod.getSource()); <<<<<<< strictAttrAttrs = Basic.parseAttributes(strictAttrValue, prod.getSource()); ======= strictAttrAttrs = Outer.parseAttributes(strictAttrValue, prod.getFilename()); >>>>>>> strictAttrAttrs = Outer.parseAttributes(strictAttrValue, prod.getSource()); <<<<<<< Attributes strictContextAttrs = Basic.parseAttributes( strictContextProdAttribute, strictContextProd.getSource()); ctx.getAttributes().putAll(strictContextAttrs); ======= Attributes strictContextAttrs = Outer.parseAttributes( strictContextProdAttribute, strictContextProd.getFilename()); ctx.getAttributes().setAll(strictContextAttrs); >>>>>>> Attributes strictContextAttrs = Outer.parseAttributes( strictContextProdAttribute, strictContextProd.getSource()); ctx.getAttributes().putAll(strictContextAttrs);
<<<<<<< public static void save(OutputStream out, Object o) throws IOException { save(out, o, "output stream"); } private static void save(OutputStream out, Object o, String name) throws IOException { try(ObjectOutputStream serializer = new ObjectOutputStream(new BufferedOutputStream(out))) { serializer.writeObject(o); } } public static <T> T load(Class<T> cls, String fileName) throws ObjectStreamException, IOException { ======= public static <T> T load(Class<T> cls, String fileName) { >>>>>>> public static void save(OutputStream out, Object o) throws IOException { save(out, o, "output stream"); } private static void save(OutputStream out, Object o, String name) throws IOException { try(ObjectOutputStream serializer = new ObjectOutputStream(new BufferedOutputStream(out))) { serializer.writeObject(o); } } public static <T> T load(Class<T> cls, String fileName) throws IOException, ClassNotFoundException { <<<<<<< public static <T> T load(Class<T> cls, String fileName, Context context) { return load(cls, fileName, context.globalOptions.debug); } public static <T> T load(Class<T> cls, String fileName, boolean debug) { try { return load(cls, fileName); ======= public static Object load(String fileName) { try { return loadWithThrow(fileName); } catch (ClassNotFoundException e) { throw new AssertionError("Something wrong with deserialization", e); >>>>>>> public static <T> T load(Class<T> cls, String fileName, Context context) { return load(cls, fileName, context.globalOptions.debug); } public static <T> T load(Class<T> cls, String fileName, boolean debug) { try { return load(cls, fileName); } catch (ClassNotFoundException e) { throw new AssertionError("Something wrong with deserialization", e); <<<<<<< if (debug) { e.printStackTrace(); } ======= >>>>>>> if (debug) { e.printStackTrace(); } <<<<<<< } public static Object load(String fileName) throws ObjectStreamException, IOException { try (ObjectInputStream deserializer = new ObjectInputStream(new BufferedInputStream(new FileInputStream(fileName)))) { return deserializer.readObject(); } catch (ClassNotFoundException e) { throw new AssertionError("Something wrong with deserialization", e); } } ======= } public static Object loadWithThrow(String fileName) throws IOException, ClassNotFoundException { try (ObjectInputStream deserializer = new ObjectInputStream(new BufferedInputStream(new FileInputStream(fileName)))) { return deserializer.readObject(); } } >>>>>>> } public static Object load(String fileName) throws IOException, ClassNotFoundException { try (ObjectInputStream deserializer = new ObjectInputStream(new BufferedInputStream(new FileInputStream(fileName)))) { return deserializer.readObject(); } }
<<<<<<< public static Term getTerm(Production prod) { ======= public static Variable getFreshVar(String sort) { return new Variable("GeneratedFreshVar" + nextVarId++, sort); } public static Term getTerm(Production prod, DefinitionHelper definitionHelper) { >>>>>>> public static Term getTerm(Production prod, DefinitionHelper definitionHelper) { <<<<<<< return KLabelConstant.of(terminal); } else if (prod.getSort().equals(BoolBuiltin.SORT_NAME)) { return BoolBuiltin.kAppOf(terminal); } else if (prod.getSort().equals(IntBuiltin.SORT_NAME)) { return IntBuiltin.kAppOf(terminal); } else if (prod.getSort().equals(StringBuiltin.SORT_NAME)) { return StringBuiltin.kAppOf(terminal); ======= return KLabelConstant.of(terminal, definitionHelper); } else if (prod.getSort().equals("#Bool")) { return BoolBuiltin.of(terminal); } else if (prod.getSort().equals("#Int")) { return IntBuiltin.of(terminal); } else if (prod.getSort().equals("#Float")) { return FloatBuiltin.of(terminal); } else if (prod.getSort().equals("#String")) { return StringBuiltin.of(terminal); >>>>>>> return KLabelConstant.of(terminal, definitionHelper); } else if (prod.getSort().equals(BoolBuiltin.SORT_NAME)) { return BoolBuiltin.kAppOf(terminal); } else if (prod.getSort().equals(IntBuiltin.SORT_NAME)) { return IntBuiltin.kAppOf(terminal); } else if (prod.getSort().equals(StringBuiltin.SORT_NAME)) { return StringBuiltin.kAppOf(terminal); <<<<<<< return KApp.of(KLabelConstant.of("#token"), StringBuiltin.kAppOf(prod.getSort()), Variable.getFreshVar("String")); ======= return KApp.of(definitionHelper, KLabelConstant.of("#token", definitionHelper), StringBuiltin.of(prod.getSort()), getFreshVar("String")); >>>>>>> return KApp.of(definitionHelper, KLabelConstant.of("#token", definitionHelper), StringBuiltin.kAppOf(prod.getSort()), Variable.getFreshVar("String"));
<<<<<<< if (context.isSubsorted("Bag", node.getSort().getName())) { ======= if (context.isSubsorted(Sort.LIST, node.getDeclaredSort().getSort())) { msg += "List, "; count++; } if (context.isSubsorted(Sort.BAG, node.getDeclaredSort().getSort())) { >>>>>>> if (context.isSubsorted(Sort.BAG, node.getDeclaredSort().getSort())) { <<<<<<< ======= if (context.isSubsorted(Sort.MAP, node.getDeclaredSort().getSort())) { msg += "Map, "; count++; } if (context.isSubsorted(Sort.SET, node.getDeclaredSort().getSort())) { msg += "Set, "; count++; } >>>>>>>
<<<<<<< import org.kframework.kore.K; import org.kframework.kore.KApply; import org.kframework.krun.api.KRunGraph; ======= >>>>>>> import org.kframework.kore.K; import org.kframework.kore.KApply; import org.kframework.krun.api.KRunGraph; <<<<<<< ======= this.useFastRewriting = !kompileOptions.experimental.koreProve; this.theFastMatcher = new FastRuleMatcher(global, allRuleBits.length()); >>>>>>> this.useFastRewriting = !kompileOptions.experimental.koreProve; this.theFastMatcher = new FastRuleMatcher(global, allRuleBits.length()); <<<<<<< return initialState; } /** * Gets the rules that could be applied to a given term according to the * rule indexing mechanism. * * @param term the given term * @return a list of rules that could be applied */ private List<Rule> getRules(Term term) { return ruleIndex.getRules(term); } ======= >>>>>>> <<<<<<< private Map<Variable, Term> getSubstitution(int n) { return n < substitutions.size() ? substitutions.get(n) : null; } private void computeRewriteStep(ConstrainedTerm subject, boolean computeOne) { subject.termContext().setTopTerm(subject.term()); results.clear(); appliedRules.clear(); substitutions.clear(); if (this.strategyIsSave(subject)) { results.add(subject/* procesat de cosmin*/); return; } if (this.strategyIsRestore(subject)) { results.add(subject/* restore by cosmin*/); return; } ======= private List<ConstrainedTerm> slowComputeRewriteStep(ConstrainedTerm subject, int step, boolean computeOne) { >>>>>>> private List<ConstrainedTerm> slowComputeRewriteStep(ConstrainedTerm subject, int step, boolean computeOne) { <<<<<<< * @param targetTerm not implemented yet * @param rules not implemented yet ======= >>>>>>> <<<<<<< * @param pattern the pattern we are searching for * @param bound a negative value specifies no bound * @param depth a negative value specifies no bound * @param searchType defines when we will attempt to match the pattern * @param computeGraph determines whether the transition graph should be computed. ======= * @param pattern the pattern we are searching for * @param bound a negative value specifies no bound * @param depth a negative value specifies no bound * @param searchType defines when we will attempt to match the pattern >>>>>>> * @param pattern the pattern we are searching for * @param bound a negative value specifies no bound * @param depth a negative value specifies no bound * @param searchType defines when we will attempt to match the pattern <<<<<<< Context kilContext = context.definition().context(); JavaKRunState startState = null; if (computeGraph) { executionGraph = new KRunGraph(); startState = new JavaKRunState(initialTerm, kilContext, counter); executionGraph.addVertex(startState); } else { executionGraph = null; } List<Substitution<Variable, Term>> searchResults = Lists.newArrayList(); ======= List<Substitution<Variable, Term>> searchResults = Lists.newArrayList(); >>>>>>> List<Substitution<Variable, Term>> searchResults = Lists.newArrayList(); <<<<<<< if (context.global().krunOptions.experimental.statistics) System.err.println("[" + visited.size() + "states, " + step + "steps, " + stopwatch + "]"); ======= if (context.global().krunOptions.experimental.statistics) System.err.println("[" + visited.size() + "states, " + 0 + "steps, " + stopwatch + "]"); >>>>>>> if (context.global().krunOptions.experimental.statistics) System.err.println("[" + visited.size() + "states, " + 0 + "steps, " + stopwatch + "]"); <<<<<<< if (context.global().krunOptions.experimental.statistics) System.err.println("[" + visited.size() + "states, " + step + "steps, " + stopwatch + "]"); ======= if (context.global().krunOptions.experimental.statistics) System.err.println("[" + visited.size() + "states, " + 0 + "steps, " + stopwatch + "]"); >>>>>>> if (context.global().krunOptions.experimental.statistics) System.err.println("[" + visited.size() + "states, " + 0 + "steps, " + stopwatch + "]"); <<<<<<< label: ======= int step; label: >>>>>>> int step; label: <<<<<<< for (int resultIndex = 0; resultIndex < results.size(); resultIndex++) { ConstrainedTerm result = results.get(resultIndex); if (computeGraph) { JavaKRunState resultState = new JavaKRunState(result.term(), kilContext, counter); JavaTransition javaTransition = new JavaTransition(appliedRules.get(resultIndex), substitutions.get(resultIndex), kilContext); executionGraph.addVertex(resultState); executionGraph.addEdge(javaTransition, startState, resultState); } ======= for (ConstrainedTerm result : results) { >>>>>>> for (ConstrainedTerm result : results) {
<<<<<<< @Test public void testSetGroup() throws JSONException { ShadowLooper looper = Shadows.shadowOf(amplitude.logThread.getLooper()); amplitude.setGroup("orgId", 15); looper.runToEndOfTasks(); looper.runToEndOfTasks(); assertEquals(getUnsentEventCount(), 0); assertEquals(getUnsentIdentifyCount(), 1); JSONObject event = getLastUnsentIdentify(); assertEquals(Constants.IDENTIFY_EVENT, event.optString("event_type")); assertEquals(event.optJSONObject("event_properties").length(), 0); JSONObject userPropertiesOperations = event.optJSONObject("user_properties"); assertEquals(userPropertiesOperations.length(), 1); assertTrue(userPropertiesOperations.has(Constants.AMP_OP_SET)); JSONObject groups = event.optJSONObject("groups"); assertEquals(groups.length(), 1); assertEquals(groups.optInt("orgId"), 15); JSONObject setOperations = userPropertiesOperations.optJSONObject(Constants.AMP_OP_SET); assertEquals(setOperations.length(), 1); assertEquals(setOperations.optInt("orgId"), 15); } @Test public void testLogEventWithGroups() throws JSONException { ShadowLooper looper = Shadows.shadowOf(amplitude.logThread.getLooper()); JSONObject groups = new JSONObject().put("orgId", 10).put("sport", "tennis"); amplitude.logEvent("test", null, groups); looper.runToEndOfTasks(); looper.runToEndOfTasks(); assertEquals(getUnsentEventCount(), 1); assertEquals(getUnsentIdentifyCount(), 0); JSONObject event = getLastUnsentEvent(); assertEquals(event.optString("event_type"), "test"); assertEquals(event.optJSONObject("event_properties").length(), 0); assertEquals(event.optJSONObject("user_properties").length(), 0); JSONObject eventGroups = event.optJSONObject("groups"); assertEquals(eventGroups.length(), 2); assertEquals(eventGroups.optInt("orgId"), 10); assertEquals(eventGroups.optString("sport"), "tennis"); } @Test public void testMergeEventsArrayIndexOutOfBounds() throws JSONException { ShadowLooper looper = Shadows.shadowOf(amplitude.logThread.getLooper()); amplitude.setOffline(true); amplitude.logEvent("testEvent1"); looper.runToEndOfTasks(); looper.runToEndOfTasks(); // force failure case amplitude.setLastEventId(0); amplitude.setOffline(false); looper.runToEndOfTasks(); // make sure next upload succeeds amplitude.setLastEventId(1); amplitude.logEvent("testEvent2"); looper.runToEndOfTasks(); looper.runToEndOfTasks(); RecordedRequest request = runRequest(amplitude); JSONArray events = getEventsFromRequest(request); assertEquals(events.length(), 2); assertEquals(events.getJSONObject(0).optString("event_type"), "testEvent1"); assertEquals(events.getJSONObject(0).optLong("event_id"), 1); assertEquals(events.getJSONObject(1).optString("event_type"), "testEvent2"); assertEquals(events.getJSONObject(1).optLong("event_id"), 2); } ======= >>>>>>> @Test public void testMergeEventsArrayIndexOutOfBounds() throws JSONException { ShadowLooper looper = Shadows.shadowOf(amplitude.logThread.getLooper()); amplitude.setOffline(true); amplitude.logEvent("testEvent1"); looper.runToEndOfTasks(); looper.runToEndOfTasks(); // force failure case amplitude.setLastEventId(0); amplitude.setOffline(false); looper.runToEndOfTasks(); // make sure next upload succeeds amplitude.setLastEventId(1); amplitude.logEvent("testEvent2"); looper.runToEndOfTasks(); looper.runToEndOfTasks(); RecordedRequest request = runRequest(amplitude); JSONArray events = getEventsFromRequest(request); assertEquals(events.length(), 2); assertEquals(events.getJSONObject(0).optString("event_type"), "testEvent1"); assertEquals(events.getJSONObject(0).optLong("event_id"), 1); assertEquals(events.getJSONObject(1).optString("event_type"), "testEvent2"); assertEquals(events.getJSONObject(1).optLong("event_id"), 2); }
<<<<<<< public static Token string2token(StringToken sort, StringToken value, TermContext context) { return Token.of(sort.stringValue(), value.stringValue()); } ======= /** * Replaces all occurrences of a string within another string. * * @param text * the string to search and replace in * @param search * the string to search for * @param replacement * the string to replace it with * @param context * the term context * @return the text with any replacements processed */ public static StringToken replaceAll(StringToken text, StringToken searchString, StringToken replacement, TermContext context) { return StringToken.of(StringUtils.replace(text.stringValue(), searchString.stringValue(), replacement.stringValue())); } /** * Replaces all occurrences of a string within another string, for the first * max values of the search string. * * @param text * the string to search and replace in * @param search * the string to search for * @param replacement * the string to replace it with * @param max * the maximum number of occurrences to be replaced * @param context * the term context * @return the text with any replacements processed */ public static StringToken replace(StringToken text, StringToken searchString, StringToken replacement, IntToken max, TermContext context) { return StringToken.of(StringUtils.replace(text.stringValue(), searchString.stringValue(), replacement.stringValue(), max.intValue())); } /** * Replaces the first occurrence of a string within another string. * * @param text * the string to search and replace in * @param search * the string to search for * @param replacement * the string to replace it with * @param context * the term context * @return the text with any replacements processed */ public static StringToken replaceFirst(StringToken text, StringToken searchString, StringToken replacement, TermContext context) { return StringToken.of(StringUtils.replaceOnce(text.stringValue(), searchString.stringValue(), replacement.stringValue())); } /** * Counts how many times the substring appears in another string. * * @param text * the string to search in * @param substr * the substring to search for * @param context * the term context * @return the number of occurrences */ public static IntToken countOccurences(StringToken text, StringToken substr, TermContext context) { return IntToken.of(StringUtils.countMatches(text.stringValue(), substr.stringValue())); } >>>>>>> public static Token string2token(StringToken sort, StringToken value, TermContext context) { return Token.of(sort.stringValue(), value.stringValue()); } /** * Replaces all occurrences of a string within another string. * * @param text * the string to search and replace in * @param search * the string to search for * @param replacement * the string to replace it with * @param context * the term context * @return the text with any replacements processed */ public static StringToken replaceAll(StringToken text, StringToken searchString, StringToken replacement, TermContext context) { return StringToken.of(StringUtils.replace(text.stringValue(), searchString.stringValue(), replacement.stringValue())); } /** * Replaces all occurrences of a string within another string, for the first * max values of the search string. * * @param text * the string to search and replace in * @param search * the string to search for * @param replacement * the string to replace it with * @param max * the maximum number of occurrences to be replaced * @param context * the term context * @return the text with any replacements processed */ public static StringToken replace(StringToken text, StringToken searchString, StringToken replacement, IntToken max, TermContext context) { return StringToken.of(StringUtils.replace(text.stringValue(), searchString.stringValue(), replacement.stringValue(), max.intValue())); } /** * Replaces the first occurrence of a string within another string. * * @param text * the string to search and replace in * @param search * the string to search for * @param replacement * the string to replace it with * @param context * the term context * @return the text with any replacements processed */ public static StringToken replaceFirst(StringToken text, StringToken searchString, StringToken replacement, TermContext context) { return StringToken.of(StringUtils.replaceOnce(text.stringValue(), searchString.stringValue(), replacement.stringValue())); } /** * Counts how many times the substring appears in another string. * * @param text * the string to search in * @param substr * the substring to search for * @param context * the term context * @return the number of occurrences */ public static IntToken countOccurences(StringToken text, StringToken substr, TermContext context) { return IntToken.of(StringUtils.countMatches(text.stringValue(), substr.stringValue())); }
<<<<<<< import org.kframework.backend.java.kil.JavaBackendRuleData; ======= import org.kframework.compile.utils.ConfigurationStructureVisitor; import org.kframework.compile.utils.MetaK; >>>>>>> import org.kframework.backend.java.kil.JavaBackendRuleData; import org.kframework.compile.utils.ConfigurationStructureVisitor; import org.kframework.compile.utils.MetaK;
<<<<<<< import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; ======= import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; import li.cil.oc.api.Network; import net.minecraft.tileentity.TileEntity; >>>>>>> import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import li.cil.oc.api.Network; import net.minecraft.tileentity.TileEntity; <<<<<<< public final class SimpleComponentTickHandler { public static final ArrayList<Runnable> pendingOperations = new java.util.ArrayList<Runnable>(); ======= public final class SimpleComponentTickHandler implements ITickHandler { public static final ArrayList<Runnable> pendingAdds = new java.util.ArrayList<Runnable>(); >>>>>>> public final class SimpleComponentTickHandler { public static final ArrayList<Runnable> pendingAdds = new java.util.ArrayList<Runnable>(); <<<<<<< @SubscribeEvent public void onTick(TickEvent.ServerTickEvent e) { synchronized (pendingOperations) { for (Runnable runnable : pendingOperations) { ======= public static void schedule(final TileEntity tileEntity) { if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { synchronized (pendingAdds) { pendingAdds.add(new Runnable() { @Override public void run() { Network.joinOrCreateNetwork(tileEntity); } }); } } } @Override public String getLabel() { return "OpenComputers SimpleComponent Ticker"; } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.SERVER); } @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { synchronized (pendingAdds) { for (Runnable runnable : pendingAdds) { >>>>>>> public static void schedule(final TileEntity tileEntity) { if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { synchronized (pendingAdds) { pendingAdds.add(new Runnable() { @Override public void run() { Network.joinOrCreateNetwork(tileEntity); } }); } } } @SubscribeEvent public void onTick(TickEvent.ServerTickEvent e) { synchronized (pendingAdds) { for (Runnable runnable : pendingAdds) {
<<<<<<< import net.minecraftforge.common.util.ForgeDirection; import scala.Array; ======= import net.minecraftforge.common.ForgeDirection; >>>>>>> import net.minecraftforge.common.util.ForgeDirection;
<<<<<<< import net.minecraftforge.common.util.ForgeDirection; ======= import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; >>>>>>> import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection;
<<<<<<< return new Environment((IInventory) world.getTileEntity(x, y, z)); ======= return new Environment(world.getBlockTileEntity(x, y, z), world); >>>>>>> return new Environment(world.getTileEntity(x, y, z), world); <<<<<<< return new Object[]{tileEntity.getInventoryName()}; ======= if (!checkPermission()) return new Object[]{null, "permission denied"}; return new Object[]{tileEntity.getInvName()}; >>>>>>> if (!checkPermission()) return new Object[]{null, "permission denied"}; return new Object[]{tileEntity.getInventoryName()};
<<<<<<< * returns a slashed or dotted class name into a signature, like java/lang/String -- Ljava/lang/String; Primitives and arrays are accepted. ======= * returns a slashed or dotted class name into a signature, like java/lang/String -- Ljava/lang/String; * Primitives and arrays are accepted. An empty or null string will result in an empty string. >>>>>>> * returns a slashed or dotted class name into a signature, like java/lang/String -- Ljava/lang/String; Primitives and arrays are accepted. <<<<<<< public static boolean isAppendableStringClassName(String className) { return Values.SLASHED_JAVA_LANG_STRINGBUILDER.equals(className) || Values.SLASHED_JAVA_LANG_STRINGBUFFER.equals(className); } ======= /** * Eclipse makes weird class signatures. */ public static boolean isWonkyEclipseSignature(String sig, int startIndex) { return (sig.length() > startIndex) && (ECLIPSE_WEIRD_SIG_CHARS.indexOf(sig.charAt(startIndex)) >= 0); } >>>>>>> public static boolean isAppendableStringClassName(String className) { return Values.SLASHED_JAVA_LANG_STRINGBUILDER.equals(className) || Values.SLASHED_JAVA_LANG_STRINGBUFFER.equals(className); } /** * Eclipse makes weird class signatures. */ public static boolean isWonkyEclipseSignature(String sig, int startIndex) { return (sig.length() > startIndex) && (ECLIPSE_WEIRD_SIG_CHARS.indexOf(sig.charAt(startIndex)) >= 0); }
<<<<<<< import org.apache.bcel.Const; ======= import javax.annotation.Nullable; >>>>>>> import javax.annotation.Nullable; import org.apache.bcel.Const; <<<<<<< /** * return the field object that the current method was called on, by finding the * reference down in the stack based on the number of parameters * * @param stk * the opcode stack where fields are stored * @param signature * the signature of the called method * * @return the field annotation for the field whose method was executed */ private static XField getFieldFromStack(final OpcodeStack stk, final String signature) { int parmCount = SignatureUtils.getNumParameters(signature); if (stk.getStackDepth() > parmCount) { OpcodeStack.Item itm = stk.getStackItem(parmCount); return itm.getXField(); } return null; } ======= /** * return the field object that the current method was called on, by finding the reference down in the stack based on the number of parameters * * @param stk * the opcode stack where fields are stored * @param signature * the signature of the called method * * @return the field annotation for the field whose method was executed */ @Nullable private static XField getFieldFromStack(final OpcodeStack stk, final String signature) { int parmCount = SignatureUtils.getNumParameters(signature); if (stk.getStackDepth() > parmCount) { OpcodeStack.Item itm = stk.getStackItem(parmCount); return itm.getXField(); } return null; } >>>>>>> /** * return the field object that the current method was called on, by finding the * reference down in the stack based on the number of parameters * * @param stk * the opcode stack where fields are stored * @param signature * the signature of the called method * * @return the field annotation for the field whose method was executed */ @Nullable private static XField getFieldFromStack(final OpcodeStack stk, final String signature) { int parmCount = SignatureUtils.getNumParameters(signature); if (stk.getStackDepth() > parmCount) { OpcodeStack.Item itm = stk.getStackItem(parmCount); return itm.getXField(); } return null; } <<<<<<< /** * builds a field annotation by finding the field in the classes' field list * * @param fieldName * the field for which to built the field annotation * * @return the field annotation of the specified field */ private FieldAnnotation getFieldAnnotation(final String fieldName) { JavaClass cls = getClassContext().getJavaClass(); Field[] fields = cls.getFields(); for (Field f : fields) { if (f.getName().equals(fieldName)) { return new FieldAnnotation(cls.getClassName(), fieldName, f.getSignature(), f.isStatic()); } } return null; // shouldn't happen } ======= /** * builds a field annotation by finding the field in the classes' field list * * @param fieldName * the field for which to built the field annotation * * @return the field annotation of the specified field */ @Nullable private FieldAnnotation getFieldAnnotation(final String fieldName) { JavaClass cls = getClassContext().getJavaClass(); Field[] fields = cls.getFields(); for (Field f : fields) { if (f.getName().equals(fieldName)) { return new FieldAnnotation(cls.getClassName(), fieldName, f.getSignature(), f.isStatic()); } } return null; // shouldn't happen } >>>>>>> /** * builds a field annotation by finding the field in the classes' field list * * @param fieldName * the field for which to built the field annotation * * @return the field annotation of the specified field */ @Nullable private FieldAnnotation getFieldAnnotation(final String fieldName) { JavaClass cls = getClassContext().getJavaClass(); Field[] fields = cls.getFields(); for (Field f : fields) { if (f.getName().equals(fieldName)) { return new FieldAnnotation(cls.getClassName(), fieldName, f.getSignature(), f.isStatic()); } } return null; // shouldn't happen }
<<<<<<< if ((m.getAccessFlags() & Const.ACC_SYNTHETIC) == 0) { if (prescreen(m)) { stack.resetForMethodEntry(this); super.visitCode(obj); break; } ======= if ((m.getAccessFlags() & ACC_SYNTHETIC) == 0) { stack.resetForMethodEntry(this); super.visitCode(obj); break; >>>>>>> if ((m.getAccessFlags() & Const.ACC_SYNTHETIC) == 0) { stack.resetForMethodEntry(this); super.visitCode(obj); break; <<<<<<< /** * looks for methods that contain a INVOKEDYNAMIC opcodes * * @param method * the context object of the current method * @return if the class uses synchronization */ private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.INVOKEDYNAMIC)); } ======= >>>>>>>
<<<<<<< import org.apache.bcel.Const; ======= import javax.annotation.Nullable; import org.apache.bcel.Constants; >>>>>>> import javax.annotation.Nullable; import org.apache.bcel.Const; <<<<<<< /** * processes a store to an array element to see if this array is being used as a * wrapper array, and if so records the register that is stored within it. * * @return the user value representing the stored register value */ private Integer processArrayElementStore() { if (stack.getStackDepth() >= 2) { OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); if (wi != null) { OpcodeStack.Item elItm = stack.getStackItem(0); wi.wrappedReg = elItm.getRegisterNumber(); } } else { OpcodeStack.Item elItm = stack.getStackItem(0); reg = elItm.getRegisterNumber(); if (reg != -1) { return Integer.valueOf(reg); } } } ======= /** * processes a store to an array element to see if this array is being used as a wrapper array, and if so records the register that is stored within it. * * @return the user value representing the stored register value */ @Nullable private Integer processArrayElementStore() { if (stack.getStackDepth() >= 2) { OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); if (wi != null) { OpcodeStack.Item elItm = stack.getStackItem(0); wi.wrappedReg = elItm.getRegisterNumber(); } } else { OpcodeStack.Item elItm = stack.getStackItem(0); reg = elItm.getRegisterNumber(); if (reg != -1) { return Integer.valueOf(reg); } } } >>>>>>> /** * processes a store to an array element to see if this array is being used as a * wrapper array, and if so records the register that is stored within it. * * @return the user value representing the stored register value */ @Nullable private Integer processArrayElementStore() { if (stack.getStackDepth() >= 2) { OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); if (wi != null) { OpcodeStack.Item elItm = stack.getStackItem(0); wi.wrappedReg = elItm.getRegisterNumber(); } } else { OpcodeStack.Item elItm = stack.getStackItem(0); reg = elItm.getRegisterNumber(); if (reg != -1) { return Integer.valueOf(reg); } } }
<<<<<<< import org.apache.bcel.Const; ======= import javax.annotation.Nullable; import org.apache.bcel.Constants; >>>>>>> import javax.annotation.Nullable; import org.apache.bcel.Const;
<<<<<<< import org.apache.bcel.Const; ======= import javax.annotation.Nullable; import org.apache.bcel.Constants; >>>>>>> import javax.annotation.Nullable; import org.apache.bcel.Const; <<<<<<< private BootstrapMethods getBootstrapAttribute(JavaClass clz) { ======= @Nullable private Attribute getBootstrapAttribute(JavaClass clz) { >>>>>>> @Nullable private BootstrapMethods getBootstrapAttribute(JavaClass clz) {
<<<<<<< bugReporter.reportBug(new BugInstance(this, BugType.SPP_USE_ISNAN.name(), NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); ======= bugReporter.reportBug(new BugInstance(this, "SPP_USE_ISNAN", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this) .addString("float") .addString("Float")); >>>>>>> bugReporter.reportBug(new BugInstance(this, BugType.SPP_USE_ISNAN.name(), NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this) .addString("float") .addString("Float"));
<<<<<<< import org.apache.bcel.Const; ======= import javax.annotation.Nullable; >>>>>>> import javax.annotation.Nullable; import org.apache.bcel.Const;
<<<<<<< import org.apache.bcel.Const; ======= import javax.annotation.Nullable; >>>>>>> import javax.annotation.Nullable; import org.apache.bcel.Const; <<<<<<< private final BugReporter bugReporter; private OpcodeStack stack; private JavaClass currentClass; private Map<JavaClass, Integer> returnTypes; /** * constructs a URV detector given the reporter to report bugs on * * @param bugReporter * the sync of bug reports */ public UnrelatedReturnValues(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** * implements the visitor to create and destroy the stack and return types * * @param classContext * the context object of the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { try { currentClass = classContext.getJavaClass(); stack = new OpcodeStack(); returnTypes = new HashMap<>(); super.visitClassContext(classContext); } finally { currentClass = null; stack = null; returnTypes = null; } } /** * implements the visitor to see if the method returns Object, and if the method * is defined in a superclass, or interface. * * @param obj * the context object of the currently parsed code block */ @Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } String signature = m.getSignature(); if (!signature.endsWith(")Ljava/lang/Object;")) { return; } stack.resetForMethodEntry(this); returnTypes.clear(); super.visitCode(obj); if (returnTypes.size() <= 1) { return; } String methodName = m.getName(); try { boolean isInherited = SignatureUtils.isInheritedMethod(currentClass, methodName, signature); int priority = NORMAL_PRIORITY; for (JavaClass cls : returnTypes.keySet()) { if ((cls != null) && Values.DOTTED_JAVA_LANG_OBJECT.equals(cls.getClassName())) { priority = LOW_PRIORITY; break; } } JavaClass cls = findCommonType(returnTypes.keySet()); BugInstance bug; if (isInherited) { bug = new BugInstance(this, BugType.URV_INHERITED_METHOD_WITH_RELATED_TYPES.name(), priority) .addClass(this).addMethod(this); if (cls != null) { bug.addString(cls.getClassName()); } } else if (cls == null) { bug = new BugInstance(this, BugType.URV_UNRELATED_RETURN_VALUES.name(), priority).addClass(this) .addMethod(this); } else { bug = new BugInstance(this, BugType.URV_CHANGE_RETURN_TYPE.name(), priority).addClass(this) .addMethod(this); bug.addString(cls.getClassName()); } for (Integer pc : returnTypes.values()) { bug.addSourceLine(this, pc.intValue()); } bugReporter.reportBug(bug); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } /** * implements the visitor to find return values where the types of objects * returned from the method are related only by object. * * @param seen * the opcode of the currently parsed instruction */ @Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); if (!itm.isNull()) { returnTypes.put(itm.getJavaClass(), Integer.valueOf(getPC())); } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { stack.sawOpcode(this, seen); } } /** * looks for a common superclass or interface for all the passed in types * * @param classes * the set of classes to look for a common super class or interface * @return the type that is the common interface or superclass (not Object, * tho). * * @throws ClassNotFoundException * if a superclass or superinterface of one of the class is not * found */ private static JavaClass findCommonType(Set<JavaClass> classes) throws ClassNotFoundException { Set<JavaClass> possibleCommonTypes = new HashSet<>(); boolean populate = true; for (JavaClass cls : classes) { if (cls == null) { return null; } if (Values.SLASHED_JAVA_LANG_OBJECT.equals(cls.getClassName())) { continue; } JavaClass[] infs = cls.getAllInterfaces(); JavaClass[] supers = cls.getSuperClasses(); if (populate) { possibleCommonTypes.addAll(Arrays.asList(infs)); possibleCommonTypes.addAll(Arrays.asList(supers)); possibleCommonTypes.remove(Repository.lookupClass(Values.SLASHED_JAVA_LANG_OBJECT)); populate = false; } else { Set<JavaClass> retain = new HashSet<>(); retain.addAll(Arrays.asList(infs)); retain.addAll(Arrays.asList(supers)); possibleCommonTypes.retainAll(retain); } } if (possibleCommonTypes.isEmpty()) { return null; } for (JavaClass cls : possibleCommonTypes) { if (cls.isInterface()) { return cls; } } return possibleCommonTypes.iterator().next(); } ======= private final BugReporter bugReporter; private OpcodeStack stack; private JavaClass currentClass; private Map<JavaClass, Integer> returnTypes; /** * constructs a URV detector given the reporter to report bugs on * * @param bugReporter * the sync of bug reports */ public UnrelatedReturnValues(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** * implements the visitor to create and destroy the stack and return types * * @param classContext * the context object of the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { try { currentClass = classContext.getJavaClass(); stack = new OpcodeStack(); returnTypes = new HashMap<>(); super.visitClassContext(classContext); } finally { currentClass = null; stack = null; returnTypes = null; } } /** * implements the visitor to see if the method returns Object, and if the method is defined in a superclass, or interface. * * @param obj * the context object of the currently parsed code block */ @Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } String signature = m.getSignature(); if (!signature.endsWith(")Ljava/lang/Object;")) { return; } stack.resetForMethodEntry(this); returnTypes.clear(); super.visitCode(obj); if (returnTypes.size() <= 1) { return; } String methodName = m.getName(); try { boolean isInherited = SignatureUtils.isInheritedMethod(currentClass, methodName, signature); int priority = NORMAL_PRIORITY; for (JavaClass cls : returnTypes.keySet()) { if ((cls != null) && Values.DOTTED_JAVA_LANG_OBJECT.equals(cls.getClassName())) { priority = LOW_PRIORITY; break; } } JavaClass cls = findCommonType(returnTypes.keySet()); BugInstance bug; if (isInherited) { bug = new BugInstance(this, BugType.URV_INHERITED_METHOD_WITH_RELATED_TYPES.name(), priority).addClass(this).addMethod(this); if (cls != null) { bug.addString(cls.getClassName()); } } else if (cls == null) { bug = new BugInstance(this, BugType.URV_UNRELATED_RETURN_VALUES.name(), priority).addClass(this).addMethod(this); } else { bug = new BugInstance(this, BugType.URV_CHANGE_RETURN_TYPE.name(), priority).addClass(this).addMethod(this); bug.addString(cls.getClassName()); } for (Integer pc : returnTypes.values()) { bug.addSourceLine(this, pc.intValue()); } bugReporter.reportBug(bug); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } /** * implements the visitor to find return values where the types of objects returned from the method are related only by object. * * @param seen * the opcode of the currently parsed instruction */ @Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == ARETURN) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); if (!itm.isNull()) { returnTypes.put(itm.getJavaClass(), Integer.valueOf(getPC())); } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { stack.sawOpcode(this, seen); } } /** * looks for a common superclass or interface for all the passed in types * * @param classes * the set of classes to look for a common super class or interface * @return the type that is the common interface or superclass (not Object, tho). * * @throws ClassNotFoundException * if a superclass or superinterface of one of the class is not found */ @Nullable private static JavaClass findCommonType(Set<JavaClass> classes) throws ClassNotFoundException { Set<JavaClass> possibleCommonTypes = new HashSet<>(); boolean populate = true; for (JavaClass cls : classes) { if (cls == null) { return null; } if (Values.SLASHED_JAVA_LANG_OBJECT.equals(cls.getClassName())) { continue; } JavaClass[] infs = cls.getAllInterfaces(); JavaClass[] supers = cls.getSuperClasses(); if (populate) { possibleCommonTypes.addAll(Arrays.asList(infs)); possibleCommonTypes.addAll(Arrays.asList(supers)); possibleCommonTypes.remove(Repository.lookupClass(Values.SLASHED_JAVA_LANG_OBJECT)); populate = false; } else { Set<JavaClass> retain = new HashSet<>(); retain.addAll(Arrays.asList(infs)); retain.addAll(Arrays.asList(supers)); possibleCommonTypes.retainAll(retain); } } if (possibleCommonTypes.isEmpty()) { return null; } for (JavaClass cls : possibleCommonTypes) { if (cls.isInterface()) { return cls; } } return possibleCommonTypes.iterator().next(); } >>>>>>> private final BugReporter bugReporter; private OpcodeStack stack; private JavaClass currentClass; private Map<JavaClass, Integer> returnTypes; /** * constructs a URV detector given the reporter to report bugs on * * @param bugReporter * the sync of bug reports */ public UnrelatedReturnValues(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** * implements the visitor to create and destroy the stack and return types * * @param classContext * the context object of the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { try { currentClass = classContext.getJavaClass(); stack = new OpcodeStack(); returnTypes = new HashMap<>(); super.visitClassContext(classContext); } finally { currentClass = null; stack = null; returnTypes = null; } } /** * implements the visitor to see if the method returns Object, and if the method * is defined in a superclass, or interface. * * @param obj * the context object of the currently parsed code block */ @Override public void visitCode(Code obj) { Method m = getMethod(); if (m.isSynthetic()) { return; } String signature = m.getSignature(); if (!signature.endsWith(")Ljava/lang/Object;")) { return; } stack.resetForMethodEntry(this); returnTypes.clear(); super.visitCode(obj); if (returnTypes.size() <= 1) { return; } String methodName = m.getName(); try { boolean isInherited = SignatureUtils.isInheritedMethod(currentClass, methodName, signature); int priority = NORMAL_PRIORITY; for (JavaClass cls : returnTypes.keySet()) { if ((cls != null) && Values.DOTTED_JAVA_LANG_OBJECT.equals(cls.getClassName())) { priority = LOW_PRIORITY; break; } } JavaClass cls = findCommonType(returnTypes.keySet()); BugInstance bug; if (isInherited) { bug = new BugInstance(this, BugType.URV_INHERITED_METHOD_WITH_RELATED_TYPES.name(), priority) .addClass(this).addMethod(this); if (cls != null) { bug.addString(cls.getClassName()); } } else if (cls == null) { bug = new BugInstance(this, BugType.URV_UNRELATED_RETURN_VALUES.name(), priority).addClass(this) .addMethod(this); } else { bug = new BugInstance(this, BugType.URV_CHANGE_RETURN_TYPE.name(), priority).addClass(this) .addMethod(this); bug.addString(cls.getClassName()); } for (Integer pc : returnTypes.values()) { bug.addSourceLine(this, pc.intValue()); } bugReporter.reportBug(bug); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } /** * implements the visitor to find return values where the types of objects * returned from the method are related only by object. * * @param seen * the opcode of the currently parsed instruction */ @Override public void sawOpcode(int seen) { try { stack.precomputation(this); if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); if (!itm.isNull()) { returnTypes.put(itm.getJavaClass(), Integer.valueOf(getPC())); } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { stack.sawOpcode(this, seen); } } /** * looks for a common superclass or interface for all the passed in types * * @param classes * the set of classes to look for a common super class or interface * @return the type that is the common interface or superclass (not Object, * tho). * * @throws ClassNotFoundException * if a superclass or superinterface of one of the class is not * found */ @Nullable private static JavaClass findCommonType(Set<JavaClass> classes) throws ClassNotFoundException { Set<JavaClass> possibleCommonTypes = new HashSet<>(); boolean populate = true; for (JavaClass cls : classes) { if (cls == null) { return null; } if (Values.SLASHED_JAVA_LANG_OBJECT.equals(cls.getClassName())) { continue; } JavaClass[] infs = cls.getAllInterfaces(); JavaClass[] supers = cls.getSuperClasses(); if (populate) { possibleCommonTypes.addAll(Arrays.asList(infs)); possibleCommonTypes.addAll(Arrays.asList(supers)); possibleCommonTypes.remove(Repository.lookupClass(Values.SLASHED_JAVA_LANG_OBJECT)); populate = false; } else { Set<JavaClass> retain = new HashSet<>(); retain.addAll(Arrays.asList(infs)); retain.addAll(Arrays.asList(supers)); possibleCommonTypes.retainAll(retain); } } if (possibleCommonTypes.isEmpty()) { return null; } for (JavaClass cls : possibleCommonTypes) { if (cls.isInterface()) { return cls; } } return possibleCommonTypes.iterator().next(); }
<<<<<<< import org.apache.bcel.Const; ======= import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.apache.bcel.Constants; >>>>>>> import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.apache.bcel.Const;
<<<<<<< public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { this.env.getMessager().printMessage(Kind.NOTE, "com.gwtplatform.dispatch.annotation.processor.GenEventProcessor started."); this.env.getMessager().printMessage(Kind.NOTE, "Searching for @GenEvent annotations."); for (Element event : roundEnv.getElementsAnnotatedWith(GenEvent.class)) { this.env.getMessager().printMessage(Kind.NOTE, "Found " + event.toString() + "."); this.generateEvent(event); } this.env.getMessager().printMessage(Kind.NOTE, "com.gwtplatform.dispatch.annotation.processor.GenEventProcessor finished."); } return true; } protected void generateEvent(Element eventElement) { GenerationHelper writer = null; ======= public void process(Element eventElement) { BuilderGenerationHelper writer = null; >>>>>>> public void process(Element eventElement) { BuilderGenerationHelper writer = null; <<<<<<< this.env.getMessager().printMessage(Kind.NOTE, "Generating '" + eventClassName + "' from '" + eventElementSimpleName + "'."); Writer sourceWriter = this.env.getFiler().createSourceFile(eventClassName, eventElement).openWriter(); writer = new GenerationHelper(sourceWriter); ======= Writer sourceWriter = getEnvironment().getFiler().createSourceFile(eventClassName, eventElement).openWriter(); writer = new BuilderGenerationHelper(sourceWriter); >>>>>>> Writer sourceWriter = getEnvironment().getFiler().createSourceFile(eventClassName, eventElement).openWriter(); writer = new BuilderGenerationHelper(sourceWriter); <<<<<<< writer.generateClassHeader(eventSimpleName, "GwtEvent<" + eventSimpleName + "." + eventElementSimpleName + "Handler>"); generateHasHandlerInterface(writer, eventElementSimpleName); ======= writer.generateClassHeader(eventSimpleName, "GwtEvent<" + eventSimpleName + "." + eventElementSimpleName + "Handler>", reflection.getClassRepresenter().getModifiers() ); writer.generateFieldDeclarations(orderedElementFields); if (reflection.hasOptionalFields()) { // has optional fields. writer.setWhitespaces(2); writer.generateBuilderClass(eventSimpleName, requiredFields, optionalFields); writer.resetWhitespaces(); if (reflection.hasRequiredFields()) { // and required fields writer.generateConstructorUsingFields(eventSimpleName, requiredFields, Modifier.PUBLIC); } writer.generateCustomBuilderConstructor(eventSimpleName, allFields); generateFireSelfMethod(writer); } else if (reflection.hasRequiredFields()) { // has only required fields writer.generateEmptyConstructor(eventSimpleName, Modifier.PROTECTED); writer.generateConstructorUsingFields(eventSimpleName, requiredFields, Modifier.PUBLIC); generateFireFieldsStaticMethod(writer, requiredFields, eventSimpleName); } else { // has no non-static fields writer.generateEmptyConstructor(eventSimpleName, Modifier.PUBLIC); generateFireFieldsStaticMethod(writer, requiredFields, eventSimpleName); } generateFireInstanceStaticMethod(writer, eventSimpleName); generateHasHandlerInterface(writer, eventElementSimpleName); >>>>>>> writer.generateClassHeader(eventSimpleName, "GwtEvent<" + eventSimpleName + "." + eventElementSimpleName + "Handler>", reflection.getClassRepresenter().getModifiers() ); writer.generateFieldDeclarations(orderedElementFields); if (reflection.hasOptionalFields()) { // has optional fields. writer.setWhitespaces(2); writer.generateBuilderClass(eventSimpleName, requiredFields, optionalFields); writer.resetWhitespaces(); if (reflection.hasRequiredFields()) { // and required fields writer.generateConstructorUsingFields(eventSimpleName, requiredFields, Modifier.PUBLIC); } writer.generateCustomBuilderConstructor(eventSimpleName, allFields); generateFireSelfMethod(writer); } else if (reflection.hasRequiredFields()) { // has only required fields writer.generateEmptyConstructor(eventSimpleName, Modifier.PROTECTED); writer.generateConstructorUsingFields(eventSimpleName, requiredFields, Modifier.PUBLIC); generateFireFieldsStaticMethod(writer, requiredFields, eventSimpleName); } else { // has no non-static fields writer.generateEmptyConstructor(eventSimpleName, Modifier.PUBLIC); generateFireFieldsStaticMethod(writer, requiredFields, eventSimpleName); } generateFireInstanceStaticMethod(writer, eventSimpleName); generateHasHandlerInterface(writer, eventElementSimpleName); <<<<<<< ======= >>>>>>> <<<<<<< generateFireMethodsUsingFields(writer, eventSimpleName, reflection); ======= >>>>>>> <<<<<<< writer.generateFieldDeclarations(orderedElementFields); Collection<VariableElement> allFields = reflection.getNonConstantFields(); Collection<VariableElement> optionalFields = reflection.getOptionalFields(); Collection<VariableElement> requiredFields = reflection.getNonConstantFields(); requiredFields.removeAll(optionalFields); writer.generateConstructorUsingFields(eventSimpleName, allFields); if (optionalFields.size() > 0) { writer.generateConstructorUsingFields(eventSimpleName, requiredFields); } if (!allFields.isEmpty() && requiredFields.size() > 0) { writer.generateEmptyConstructor(eventSimpleName, Modifier.PROTECTED); } ======= >>>>>>> <<<<<<< writer.generateFieldAccessors(orderedElementFields); ======= >>>>>>> <<<<<<< ======= writer.generateFieldAccessors(orderedElementFields); >>>>>>> writer.generateFieldAccessors(orderedElementFields);
<<<<<<< public class LoginPresenter extends Presenter<LoginPresenter.MyView, LoginPresenter.MyProxy> implements LoginUiHandlers { ======= public class LoginPresenter extends Presenter<LoginPresenter.MyView, LoginPresenter.MyProxy> implements LoginUiHandlers { >>>>>>> public class LoginPresenter extends Presenter<LoginPresenter.MyView, LoginPresenter.MyProxy> implements LoginUiHandlers { <<<<<<< LoginPresenter(EventBus eventBus, MyView view, MyProxy proxy, PlaceManager placeManager, DispatchAsync dispatchAsync, CurrentUser currentUser, LoginMessages messages) { ======= public LoginPresenter( EventBus eventBus, MyView view, MyProxy proxy, PlaceManager placeManager, DispatchAsync dispatchAsync, SessionService sessionService, CurrentUser currentUser, LoginMessages messages) { >>>>>>> LoginPresenter(EventBus eventBus, MyView view, MyProxy proxy, PlaceManager placeManager, DispatchAsync dispatchAsync, SessionService sessionService, CurrentUser currentUser, LoginMessages messages) {
<<<<<<< CarsPresenter(EventBus eventBus, MyView view, MyProxy proxy, DispatchAsync dispatcher, PlaceManager placeManager, CarProxyFactory carProxyFactory) { ======= public CarsPresenter( EventBus eventBus, MyView view, MyProxy proxy, DispatchAsync dispatcher, CarService carService, PlaceManager placeManager, CarProxyFactory carProxyFactory) { >>>>>>> CarsPresenter(EventBus eventBus, MyView view, MyProxy proxy, DispatchAsync dispatcher, CarService carService, PlaceManager placeManager, CarProxyFactory carProxyFactory) {
<<<<<<< private PresenterWidget<?> activePresenter = null; ======= >>>>>>> <<<<<<< activePresenter = revealContentEvent.getContent(); ======= >>>>>>> <<<<<<< activePresenter = revealContentEvent.getContent(); ======= >>>>>>>
<<<<<<< if (this.errorReveal == false) { this.errorReveal = true; revealDefaultPlace(); } else { throw new RuntimeException( "revealErrorPlace is set to revealDefaultPlace. However revealDefaultPlace is causing an error which if left to continue will result in an infinite loop."); } ======= revealDefaultPlace(); >>>>>>> if (this.errorReveal == false) { this.errorReveal = true; revealDefaultPlace(); } else { throw new RuntimeException( "revealErrorPlace is set to revealDefaultPlace. However revealDefaultPlace is causing an error which if left to continue will result in an infinite loop."); } <<<<<<< public final void revealPlaceHierarchy( List<PlaceRequest> placeRequestHierarchy) { if (!confirmLeaveState()) ======= public final void revealPlaceHierarchy( List<PlaceRequest> placeRequestHierarchy ) { if( !confirmLeaveState() ) >>>>>>> public final void revealPlaceHierarchy( List<PlaceRequest> placeRequestHierarchy) { if (!confirmLeaveState()) <<<<<<< public final void revealPlace(PlaceRequest request) { if (!confirmLeaveState()) ======= public final void revealPlace( PlaceRequest request ) { if( !confirmLeaveState() ) >>>>>>> public final void revealPlace(PlaceRequest request) { if (!confirmLeaveState()) <<<<<<< } catch (TokenFormatException e) { revealErrorPlace(historyToken); NavigationEvent.fire(eventBus, null); ======= } catch ( TokenFormatException e ) { revealErrorPlace( historyToken ); NavigationEvent.fire( this, null ); >>>>>>> } catch (TokenFormatException e) { revealErrorPlace(historyToken); NavigationEvent.fire(eventBus, null); <<<<<<< private final void doRevealPlace(PlaceRequest request) { PlaceRequestInternalEvent requestEvent = new PlaceRequestInternalEvent( request); eventBus.fireEvent(requestEvent); if (!requestEvent.isHandled()) revealErrorPlace(tokenFormatter.toHistoryToken(placeHierarchy)); else if (!requestEvent.isAuthorized()) revealUnauthorizedPlace(tokenFormatter.toHistoryToken(placeHierarchy)); this.errorReveal = false; NavigationEvent.fire(eventBus, request); ======= private final void doRevealPlace( PlaceRequest request ) { PlaceRequestInternalEvent requestEvent = new PlaceRequestInternalEvent( request ); fireEvent(requestEvent); if( !requestEvent.isHandled() ) revealErrorPlace( tokenFormatter.toHistoryToken( placeHierarchy ) ); else if( !requestEvent.isAuthorized() ) revealUnauthorizedPlace( tokenFormatter.toHistoryToken( placeHierarchy ) ); NavigationEvent.fire( this, request ); >>>>>>> private final void doRevealPlace(PlaceRequest request) { PlaceRequestInternalEvent requestEvent = new PlaceRequestInternalEvent( request); fireEvent(requestEvent); if (!requestEvent.isHandled()) revealErrorPlace(tokenFormatter.toHistoryToken(placeHierarchy)); else if (!requestEvent.isAuthorized()) revealUnauthorizedPlace(tokenFormatter.toHistoryToken(placeHierarchy)); this.errorReveal = false; NavigationEvent.fire(eventBus, request); <<<<<<< NavigationRefusedEvent.fire(eventBus); ======= NavigationRefusedEvent.fire( this ); >>>>>>> NavigationRefusedEvent.fire( this ); <<<<<<< public void getCurrentTitle(int index, SetPlaceTitleHandler handler) throws IndexOutOfBoundsException { GetPlaceTitleEvent event = new GetPlaceTitleEvent( placeHierarchy.get(index), handler); eventBus.fireEvent(event); ======= public void getCurrentTitle( int index, SetPlaceTitleHandler handler ) throws IndexOutOfBoundsException { GetPlaceTitleEvent event = new GetPlaceTitleEvent( placeHierarchy.get(index), handler ); fireEvent( event ); >>>>>>> public void getCurrentTitle(int index, SetPlaceTitleHandler handler) throws IndexOutOfBoundsException { GetPlaceTitleEvent event = new GetPlaceTitleEvent( placeHierarchy.get(index), handler); fireEvent( event );
<<<<<<< @XCSRFHeaderName String securityHeaderName, @RequestTimeout Integer requestTimeoutMs) { ======= @XSRFHeaderName String securityHeaderName) { >>>>>>> @XSRFHeaderName String securityHeaderName, @RequestTimeout Integer requestTimeoutMs) {
<<<<<<< public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { this.env.getMessager().printMessage(Kind.NOTE, "com.gwtplatform.dispatch.annotation.processor.GenDtoProcessor started."); this.env.getMessager().printMessage(Kind.NOTE, "Searching for @GenDto annotations."); for (Element dto : roundEnv.getElementsAnnotatedWith(GenDto.class)) { this.env.getMessager().printMessage(Kind.NOTE, "Found " + dto.toString() + "."); this.generateDto(dto); } this.env.getMessager().printMessage(Kind.NOTE, "com.gwtplatform.dispatch.annotation.processor.GenDtoProcessor finished."); } return true; } void generateDto(Element dtoElement) { GenerationHelper writer = null; ======= public void process(Element dtoElement) { BuilderGenerationHelper writer = null; >>>>>>> public void process(Element dtoElement) { BuilderGenerationHelper writer = null; <<<<<<< this.env.getMessager().printMessage(Kind.NOTE, "Generating '" + dtoClassName + "' from '" + dtoElementSimpleName + "'."); Writer sourceWriter = this.env.getFiler().createSourceFile(dtoClassName, dtoElement).openWriter(); writer = new GenerationHelper(sourceWriter); Collection<VariableElement> orderedElementFields = reflection.getOrderedFields(); writer.generatePackageDeclaration(reflection.getPackageName()); writer.generateImports("com.google.gwt.user.client.rpc.IsSerializable"); writer.generateClassHeader(dtoSimpleName, null, "IsSerializable"); writer.generateFieldDeclarations(orderedElementFields); ======= printMessage("Generating '" + dtoClassName + "' from '" + dtoElementSimpleName + "'."); Writer sourceWriter = getEnvironment().getFiler().createSourceFile(dtoClassName, dtoElement).openWriter(); writer = new BuilderGenerationHelper(sourceWriter); Collection<VariableElement> orderedElementFields = reflection.getOrderedFields(); >>>>>>> printMessage("Generating '" + dtoClassName + "' from '" + dtoElementSimpleName + "'."); Writer sourceWriter = getEnvironment().getFiler().createSourceFile(dtoClassName, dtoElement).openWriter(); writer = new BuilderGenerationHelper(sourceWriter); Collection<VariableElement> orderedElementFields = reflection.getOrderedFields(); <<<<<<< writer.generateConstructorUsingFields(dtoSimpleName, allFields); if (optionalFields.size() > 0) { writer.generateConstructorUsingFields(dtoSimpleName, requiredFields); } if (!allFields.isEmpty() && requiredFields.size() > 0) { ======= writer.generatePackageDeclaration(reflection.getPackageName()); writer.generateImports("com.google.gwt.user.client.rpc.IsSerializable"); writer.generateClassHeader(dtoSimpleName, null, reflection.getClassRepresenter().getModifiers(), "IsSerializable"); writer.generateFieldDeclarations(orderedElementFields); if (reflection.hasOptionalFields()) { // has optional fields. writer.setWhitespaces(2); writer.generateBuilderClass(dtoSimpleName, requiredFields, optionalFields); writer.resetWhitespaces(); >>>>>>> writer.generatePackageDeclaration(reflection.getPackageName()); writer.generateImports("com.google.gwt.user.client.rpc.IsSerializable"); writer.generateClassHeader(dtoSimpleName, null, reflection.getClassRepresenter().getModifiers(), "IsSerializable"); writer.generateFieldDeclarations(orderedElementFields); if (reflection.hasOptionalFields()) { // has optional fields. writer.setWhitespaces(2); writer.generateBuilderClass(dtoSimpleName, requiredFields, optionalFields); writer.resetWhitespaces(); <<<<<<< ======= >>>>>>>
<<<<<<< @NameToken(NameTokens.DETAIL_MANUFACTURER) @UseGatekeeper(LoggedInGatekeeper.class) ======= @NameToken(NameTokens.detailManufacturer) >>>>>>> @NameToken(NameTokens.DETAIL_MANUFACTURER)
<<<<<<< @NameToken(NameTokens.MANUFACTURER) @UseGatekeeper(LoggedInGatekeeper.class) ======= @NameToken(NameTokens.manufacturer) >>>>>>> @NameToken(NameTokens.MANUFACTURER)
<<<<<<< import com.webank.wecube.platform.core.domain.plugin.PluginPackageAuthority; ======= import com.webank.wecube.platform.core.dto.PluginConfigDto; import com.webank.wecube.platform.core.dto.PluginPackageDependencyDto; >>>>>>> import com.webank.wecube.platform.core.domain.plugin.PluginPackageAuthority; import com.webank.wecube.platform.core.dto.PluginConfigDto; <<<<<<< ======= import java.util.Collections; >>>>>>> import java.util.Collections; <<<<<<< import static com.webank.wecube.platform.core.domain.JsonResponse.*; ======= import static com.google.common.collect.Sets.newLinkedHashSet; import static com.webank.wecube.platform.core.domain.JsonResponse.okay; import static com.webank.wecube.platform.core.domain.JsonResponse.error; import static com.webank.wecube.platform.core.domain.JsonResponse.okayWithData; >>>>>>> import static com.google.common.collect.Sets.newLinkedHashSet; import static com.webank.wecube.platform.core.domain.JsonResponse.*;
<<<<<<< private Stack<DataModelExpressionDto> chainRequest(ChainRequestDto chainRequestDto, DataModelExpressionToRootData dataModelExpressionToRootData) { String dataModelExpression = dataModelExpressionToRootData.getDataModelExpression(); String rootIdData = dataModelExpressionToRootData.getRootData(); ======= private Stack<DataModelExpressionDto> chainRequest(ChainRequestDto chainRequestDto) { String dataModelExpression = chainRequestDto.getDataModelExpressionToRootData().getDataModelExpression(); String rootIdData = chainRequestDto.getDataModelExpressionToRootData().getRootData(); logger.info(String.format("Setting up chain request process, the DME is [%s] and the root id data is [%s].", dataModelExpression, rootIdData)); >>>>>>> private Stack<DataModelExpressionDto> chainRequest(ChainRequestDto chainRequestDto, DataModelExpressionToRootData dataModelExpressionToRootData) { String dataModelExpression = dataModelExpressionToRootData.getDataModelExpression(); String rootIdData = dataModelExpressionToRootData.getRootData(); logger.info(String.format("Setting up chain request process, the DME is [%s] and the root id data is [%s].", dataModelExpression, rootIdData)); <<<<<<< List<CommonResponseDto> lastRequestResultList = lastExpressionDto.getJsonResponseStack().peek(); ======= logger.info(String.format("Entering resolving subsequent link process, the last expression is [%s], now resolving new subsequent link [%s].", lastExpressionDto.getExpression(), expressionDto.getExpression())); List<CommonResponseDto> lastRequestResultList = lastExpressionDto.getReturnedJson().peek(); >>>>>>> logger.info(String.format("Entering resolving subsequent link process, the last expression is [%s], now resolving new subsequent link [%s].", lastExpressionDto.getExpression(), expressionDto.getExpression())); List<CommonResponseDto> lastRequestResultList = lastExpressionDto.getJsonResponseStack().peek();
<<<<<<< List<PluginMysqlInstance> findByPluginPackageIdAndStatus(Integer pluginPackageId, String status); ======= PluginMysqlInstance findByPluginPackageId(int packageId); >>>>>>> List<PluginMysqlInstance> findByPluginPackageIdAndStatus(Integer pluginPackageId, String status); PluginMysqlInstance findByPluginPackageId(int packageId);
<<<<<<< String dockerImageUrl = s3Client.uploadFile(pluginProperties.getPluginPackageBucketName(), keyName, pluginDockerImageFile); log.info("Plugin Package has uploaded to MinIO {}", dockerImageUrl); ======= dockerImageUrl = s3Client.uploadFile(pluginProperties.getPluginPackageBucketName(), keyName, pluginDockerImageFile); log.info("Plugin Package has uploaded to MinIO {}", dockerImageUrl.split("\\?")[0]); >>>>>>> String dockerImageUrl = s3Client.uploadFile(pluginProperties.getPluginPackageBucketName(), keyName, pluginDockerImageFile); log.info("Plugin Package has uploaded to MinIO {}", dockerImageUrl.split("\\?")[0]); <<<<<<< String uiPackageUrl = s3Client.uploadFile(pluginProperties.getPluginPackageBucketName(), keyName, pluginUiPackageFile); log.info("UI static package file has uploaded to MinIO {}", uiPackageUrl); ======= uiPackageUrl = s3Client.uploadFile(pluginProperties.getPluginPackageBucketName(), keyName, pluginUiPackageFile); log.info("UI static package file has uploaded to MinIO {}", uiPackageUrl.split("\\?")[0]); >>>>>>> String uiPackageUrl = s3Client.uploadFile(pluginProperties.getPluginPackageBucketName(), keyName, pluginUiPackageFile); log.info("UI static package file has uploaded to MinIO {}", uiPackageUrl.split("\\?")[0]);
<<<<<<< String entityId = pluginConfig.getEntityId(); if (StringUtils.isNotBlank(entityId)) { ======= if (DISABLED != pluginConfig.getStatus()) { throw new WecubeCoreException("Not allow to enable pluginConfig with status: ENABLED"); } Integer entityId = pluginConfig.getEntityId(); if (null != entityId && entityId.intValue() > 0) { >>>>>>> String entityId = pluginConfig.getEntityId(); if (StringUtils.isNotBlank(entityId)) { if (DISABLED != pluginConfig.getStatus()) { throw new WecubeCoreException("Not allow to enable pluginConfig with status: ENABLED"); } <<<<<<< public PluginConfigDto disablePlugin(String pluginConfigId) { ======= private void checkMandatoryParameters(PluginConfig pluginConfig) { Set<PluginConfigInterface> interfaces = pluginConfig.getInterfaces(); if (null != interfaces && interfaces.size() > 0) { interfaces.forEach(intf->{ Set<PluginConfigInterfaceParameter> inputParameters = intf.getInputParameters(); if (null != inputParameters && inputParameters.size() > 0){ inputParameters.forEach(inputParameter -> { if ("Y".equalsIgnoreCase(inputParameter.getRequired())) { if (system_variable.name().equals(inputParameter.getMappingType()) && inputParameter.getMappingSystemVariableId() == null ) { throw new WecubeCoreException(String.format("System variable is required for parameter [%s]", inputParameter.getId())); } if (entity.name().equals(inputParameter.getMappingType()) && StringUtils.isBlank(inputParameter.getMappingEntityExpression())) { throw new WecubeCoreException(String.format("Entity expression is required for parameter [%s]", inputParameter.getId())); } } }); } Set<PluginConfigInterfaceParameter> outputParameters = intf.getOutputParameters(); if (null != outputParameters && outputParameters.size() > 0) { outputParameters.forEach(outputParameter -> { if ("Y".equalsIgnoreCase(outputParameter.getRequired())) { if (entity.name().equals(outputParameter.getMappingType()) && StringUtils.isBlank(outputParameter.getMappingEntityExpression())) { throw new WecubeCoreException(String.format("Entity expression is required for parameter [%s]", outputParameter.getId())); } } }); } } ); } } public PluginConfigDto disablePlugin(int pluginConfigId) { >>>>>>> private void checkMandatoryParameters(PluginConfig pluginConfig) { Set<PluginConfigInterface> interfaces = pluginConfig.getInterfaces(); if (null != interfaces && interfaces.size() > 0) { interfaces.forEach(intf->{ Set<PluginConfigInterfaceParameter> inputParameters = intf.getInputParameters(); if (null != inputParameters && inputParameters.size() > 0){ inputParameters.forEach(inputParameter -> { if ("Y".equalsIgnoreCase(inputParameter.getRequired())) { if (system_variable.name().equals(inputParameter.getMappingType()) && inputParameter.getMappingSystemVariableId() == null ) { throw new WecubeCoreException(String.format("System variable is required for parameter [%s]", inputParameter.getId())); } if (entity.name().equals(inputParameter.getMappingType()) && StringUtils.isBlank(inputParameter.getMappingEntityExpression())) { throw new WecubeCoreException(String.format("Entity expression is required for parameter [%s]", inputParameter.getId())); } } }); } Set<PluginConfigInterfaceParameter> outputParameters = intf.getOutputParameters(); if (null != outputParameters && outputParameters.size() > 0) { outputParameters.forEach(outputParameter -> { if ("Y".equalsIgnoreCase(outputParameter.getRequired())) { if (entity.name().equals(outputParameter.getMappingType()) && StringUtils.isBlank(outputParameter.getMappingEntityExpression())) { throw new WecubeCoreException(String.format("Entity expression is required for parameter [%s]", outputParameter.getId())); } } }); } } ); } } public PluginConfigDto disablePlugin(String pluginConfigId) {
<<<<<<< ======= public void findMaxPortByHost() { PluginPackage pluginPackage = new PluginPackage(null, "test-findSavedInstanceByContainerId", "v1", newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet()); PluginConfig pluginConfig = new PluginConfig(null, pluginPackage, "VM", null, "VM", PluginConfig.Status.DISABLED, null); pluginPackage.setPluginConfigs(newLinkedHashSet(pluginConfig)); pluginPackageRepository.save(pluginPackage); PluginInstance pluginInstance = new PluginInstance(null, pluginPackage, "test-instance-container-id", "localhost", 29999, "running"); pluginInstanceRepository.save(pluginInstance); Integer foundPluginInstancePort = pluginInstanceRepository.findMaxPortByHost("localhost"); assertThat(foundPluginInstancePort).isEqualTo(pluginInstance.getPort()); } @Test public void findByPackageIdAndStatus() { PluginPackage pluginPackage = new PluginPackage(null, "test-findSavedInstanceByContainerId", "v1", newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet()); PluginConfig pluginConfig = new PluginConfig(null, pluginPackage, "VM", null, "VM", PluginConfig.Status.DISABLED, null); pluginPackage.setPluginConfigs(newLinkedHashSet(pluginConfig)); pluginPackageRepository.save(pluginPackage); PluginInstance pluginInstance = new PluginInstance(null, pluginPackage, "test-instance-container-id", "localhost", 20000, "RUNNING"); pluginInstanceRepository.save(pluginInstance); List<PluginInstance> pluginInstances = pluginInstanceRepository.findByStatusAndPackageId("RUNNING", pluginPackage.getId()); assertThat(pluginInstances.get(0).getInstanceContainerId()).isEqualTo(pluginInstance.getInstanceContainerId()); } @Test >>>>>>> public void findMaxPortByHost() { PluginPackage pluginPackage = new PluginPackage(null, "test-findSavedInstanceByContainerId", "v1", newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet()); PluginConfig pluginConfig = new PluginConfig(null, pluginPackage, "VM", null, "VM", PluginConfig.Status.DISABLED, null); pluginPackage.setPluginConfigs(newLinkedHashSet(pluginConfig)); pluginPackageRepository.save(pluginPackage); PluginInstance pluginInstance = new PluginInstance(null, pluginPackage, "test-instance-container-id", "localhost", 29999, "running"); pluginInstanceRepository.save(pluginInstance); Integer foundPluginInstancePort = pluginInstanceRepository.findMaxPortByHost("localhost"); assertThat(foundPluginInstancePort).isEqualTo(pluginInstance.getPort()); } @Test <<<<<<< PluginPackage mockPluginPackage = new PluginPackage(null, name, version, newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet()); PluginConfig mockPlugin = new PluginConfig(null, mockPluginPackage, "mockPlugin", null, "mockEntity", UNREGISTERED, newLinkedHashSet()); ======= PluginPackage mockPluginPackage = new PluginPackage(null, name, version, newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet()); PluginConfig mockPlugin = new PluginConfig(null, mockPluginPackage, "mockPlugin", null, "mockEntity", PluginConfig.Status.DISABLED, newLinkedHashSet()); >>>>>>> PluginPackage mockPluginPackage = new PluginPackage(null, name, version, newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet(), newLinkedHashSet()); PluginConfig mockPlugin = new PluginConfig(null, mockPluginPackage, "mockPlugin", null, "mockEntity", PluginConfig.Status.DISABLED, newLinkedHashSet());
<<<<<<< // #1993 ======= // TODO //1 if(LocalWorkflowConstants.CONTEXT_NAME_PROC_DEF_KEY.equals(bindParamName)){ String procDefKey = procInstEntity.getProcDefKey(); objectVals.add(procDefKey); return; } //2 >>>>>>> // #1993 //1 if(LocalWorkflowConstants.CONTEXT_NAME_PROC_DEF_KEY.equals(bindParamName)){ String procDefKey = procInstEntity.getProcDefKey(); objectVals.add(procDefKey); return; } //2
<<<<<<< if (needCreateS3Bucket) { String s3BucketResourceId = initS3BucketResource(s3InfoSet, initMysqlReturn); if (s3BucketResourceId != null) instance.setS3BucketResourceId(s3BucketResourceId); } ======= Integer s3BucketResourceId = handleCreateS3Bucket(s3InfoSet, pluginPackage); if (s3BucketResourceId != null) instance.setS3BucketResourceId(s3BucketResourceId); >>>>>>> String s3BucketResourceId = handleCreateS3Bucket(s3InfoSet, pluginPackage); if (s3BucketResourceId != null) instance.setS3BucketResourceId(s3BucketResourceId); <<<<<<< private String initS3BucketResource(Set<PluginPackageRuntimeResourcesS3> s3InfoSet, InitMysqlReturn initPaasResourceReturn) { ======= private Integer initS3BucketResource(Set<PluginPackageRuntimeResourcesS3> s3InfoSet) { >>>>>>> private String initS3BucketResource(Set<PluginPackageRuntimeResourcesS3> s3InfoSet) { <<<<<<< private class InitMysqlReturn { DatabaseInfo dbInfo; String mysqlInstanceResourceId; public DatabaseInfo getDbInfo() { return dbInfo; } public void setDbInfo(DatabaseInfo dbInfo) { this.dbInfo = dbInfo; } public String getMysqlInstanceResourceId() { return mysqlInstanceResourceId; } public void setMysqlInstanceResourceId(String mysqlInstanceResourceId) { this.mysqlInstanceResourceId = mysqlInstanceResourceId; } } ======= >>>>>>>
<<<<<<< import com.webank.wecube.platform.core.jpa.PluginConfigInterfaceRepository; import com.webank.wecube.platform.core.jpa.PluginConfigRepository; import com.webank.wecube.platform.core.jpa.PluginPackageEntityRepository; import com.webank.wecube.platform.core.jpa.PluginPackageRepository; import com.webank.wecube.platform.core.parser.datamodel.antlr4.DataModelParser.PkgContext; ======= import com.webank.wecube.platform.core.jpa.*; >>>>>>> import com.webank.wecube.platform.core.jpa.PluginConfigInterfaceRepository; import com.webank.wecube.platform.core.jpa.PluginConfigRepository; import com.webank.wecube.platform.core.jpa.PluginPackageEntityRepository; import com.webank.wecube.platform.core.jpa.PluginPackageRepository; import com.webank.wecube.platform.core.jpa.*;
<<<<<<< private final List<MessageBodyReader<?>> bodyReaders = new ArrayList<>(); private final List<MessageBodyWriter<?>> bodyWriters = new ArrayList<>(); ======= private final List<MessageBodyReader> bodyReaders = new ArrayList<>(); private final List<MessageBodyWriter> bodyWriters = new ArrayList<>(); private List<ParameterInjector<?>> parameterInjectors; >>>>>>> private final List<MessageBodyReader<?>> bodyReaders = new ArrayList<>(); private final List<MessageBodyWriter<?>> bodyWriters = new ArrayList<>(); private List<ParameterInjector<?>> parameterInjectors;
<<<<<<< BigDecimal longStepSize = longExchange.getExchangeMetaData().getCurrencyPairs().get(currencyPair).getAmountStepSize(); BigDecimal shortStepSize = shortExchange.getExchangeMetaData().getCurrencyPairs().get(currencyPair).getAmountStepSize(); LOGGER.info("{} trade amount step size: {}", longExchange.getExchangeSpecification().getExchangeName(), longStepSize); LOGGER.info("{} trade amount step size: {}", shortExchange.getExchangeSpecification().getExchangeName(), shortStepSize); if (longStepSize != null) { longVolume = roundByStep(longVolume, longStepSize); } if (shortStepSize != null) { shortVolume = roundByStep(shortVolume, shortStepSize); } ======= >>>>>>> BigDecimal longStepSize = longExchange.getExchangeMetaData().getCurrencyPairs().get(currencyPair).getAmountStepSize(); BigDecimal shortStepSize = shortExchange.getExchangeMetaData().getCurrencyPairs().get(currencyPair).getAmountStepSize(); LOGGER.info("{} trade amount step size: {}", longExchange.getExchangeSpecification().getExchangeName(), longStepSize); LOGGER.info("{} trade amount step size: {}", shortExchange.getExchangeSpecification().getExchangeName(), shortStepSize); if (longStepSize != null) { longVolume = roundByStep(longVolume, longStepSize); } if (shortStepSize != null) { shortVolume = roundByStep(shortVolume, shortStepSize); } <<<<<<< static BigDecimal roundByStep(BigDecimal input, BigDecimal step) { return input .divide(step, RoundingMode.HALF_EVEN) .round(MathContext.DECIMAL64) .multiply(step); } ======= private int getScale(Exchange exchange, Currency currency) { if (exchange.getExchangeMetaData() != null) { if (exchange.getExchangeMetaData().getCurrencies().get(currency) != null) { return exchange.getExchangeMetaData().getCurrencies().get(currency).getScale(); } } return BTC_SCALE; } >>>>>>> private int getScale(Exchange exchange, Currency currency) { if (exchange.getExchangeMetaData() != null) { if (exchange.getExchangeMetaData().getCurrencies().get(currency) != null) { return exchange.getExchangeMetaData().getCurrencies().get(currency).getScale(); } } return BTC_SCALE; } static BigDecimal roundByStep(BigDecimal input, BigDecimal step) { return input .divide(step, RoundingMode.HALF_EVEN) .round(MathContext.DECIMAL64) .multiply(step); }
<<<<<<< private void logCurrentExchangeBalances(Exchange longExchange, Exchange shortExchange) { try { BigDecimal longBalance = getAccountBalance(longExchange); BigDecimal shortBalance = getAccountBalance(shortExchange); LOGGER.info("Updated account balances: {} ${} / {} ${} = ${}", longExchange.getExchangeSpecification().getExchangeName(), longBalance, shortExchange.getExchangeSpecification().getExchangeName(), shortBalance, longBalance.add(shortBalance)); } catch (IOException e) { LOGGER.error("IOE fetching account balances: ", e); } } private BigDecimal getAccountBalance(Exchange exchange, Currency currency) throws IOException { ======= BigDecimal getAccountBalance(Exchange exchange, Currency currency) throws IOException { >>>>>>> private void logCurrentExchangeBalances(Exchange longExchange, Exchange shortExchange) { try { BigDecimal longBalance = getAccountBalance(longExchange); BigDecimal shortBalance = getAccountBalance(shortExchange); LOGGER.info("Updated account balances: {} ${} / {} ${} = ${}", longExchange.getExchangeSpecification().getExchangeName(), longBalance, shortExchange.getExchangeSpecification().getExchangeName(), shortBalance, longBalance.add(shortBalance)); } catch (IOException e) { LOGGER.error("IOE fetching account balances: ", e); } } BigDecimal getAccountBalance(Exchange exchange, Currency currency) throws IOException {
<<<<<<< //Adjust order volumes so they match the fee computation, step size and scales of the exchanges try{ tradeVolume.adjustOrderVolume(longExchangeName, shortExchangeName, longAmountStepSize, shortAmountStepSize); } catch(IllegalArgumentException e) { LOGGER.error("Cannot adjust order volumes, exiting trade."); return; } //Scales or steps might have broken market neutrality, check that the entry is still as market neutral as possible //Otherwise it could mess with profit estimations! if (!conditionService.isForceOpenCondition(spread.getCurrencyPair(), longExchangeName, shortExchangeName) && !tradeVolume.isMarketNeutral()) { LOGGER.info("Trade is not market neutral (market neutrality rating is {}), profit estimates might be off, will not trade.", tradeVolume.getMarketNeutralityRating()); return; } logEntryTrade(spread, shortExchangeName, longExchangeName, exitTarget, tradeVolume, longLimitPrice, shortLimitPrice); ======= logEntryTrade(spread, shortExchangeName, longExchangeName, exitTarget, longVolume, shortVolume, longLimitPrice, shortLimitPrice, isForcedOpenCondition); >>>>>>> //Adjust order volumes so they match the fee computation, step size and scales of the exchanges try{ tradeVolume.adjustOrderVolume(longExchangeName, shortExchangeName, longAmountStepSize, shortAmountStepSize); } catch(IllegalArgumentException e) { LOGGER.error("Cannot adjust order volumes, exiting trade."); return; } //Scales or steps might have broken market neutrality, check that the entry is still as market neutral as possible //Otherwise it could mess with profit estimations! if (!conditionService.isForceOpenCondition(spread.getCurrencyPair(), longExchangeName, shortExchangeName) && !tradeVolume.isMarketNeutral()) { LOGGER.info("Trade is not market neutral (market neutrality rating is {}), profit estimates might be off, will not trade.", tradeVolume.getMarketNeutralityRating()); return; } logEntryTrade(spread, shortExchangeName, longExchangeName, exitTarget, tradeVolume, longLimitPrice, shortLimitPrice, isForcedOpenCondition); <<<<<<< notificationService.sendEmailNotificationBodyForEntryTrade(spread, exitTarget, tradeVolume.getLongVolume(), longLimitPrice, tradeVolume.getShortVolume(), shortLimitPrice); ======= notificationService.sendEntryTradeNotification(spread, exitTarget, longVolume, longLimitPrice, shortVolume, shortLimitPrice, isForcedOpenCondition); >>>>>>> notificationService.sendEmailNotificationBodyForEntryTrade(spread, exitTarget, tradeVolume.getLongVolume(), longLimitPrice, tradeVolume.getShortVolume(), shortLimitPrice, isForcedOpenCondition); <<<<<<< LOGGER.info("Exit spread: {}", spread.getOut()); LOGGER.info("Exit spread target: {}", activePosition.getExitTarget()); LOGGER.info("Long close: {} {} {} @ {} (slipped from {}) = {}{} (slipped from {}{})", longExchangeName, spread.getCurrencyPair(), tradeVolume.getLongVolume(), longLimitPrice, spread.getLongTicker().getBid().toPlainString(), Currency.USD.getSymbol(), tradeVolume.getLongVolume().multiply(longLimitPrice).toPlainString(), Currency.USD.getSymbol(), tradeVolume.getLongVolume().multiply(spread.getLongTicker().getBid()).toPlainString()); LOGGER.info("Short close: {} {} {} @ {} (slipped from {}) = {}{} (slipped from {}{})", shortExchangeName, spread.getCurrencyPair(), tradeVolume.getShortVolume(), shortLimitPrice, spread.getShortTicker().getAsk().toPlainString(), Currency.USD.getSymbol(), tradeVolume.getShortVolume().multiply(shortLimitPrice).toPlainString(), Currency.USD.getSymbol(), tradeVolume.getShortVolume().multiply(spread.getShortTicker().getAsk()).toPlainString()); ======= >>>>>>> LOGGER.info("Exit spread: {}", spread.getOut()); LOGGER.info("Exit spread target: {}", activePosition.getExitTarget()); LOGGER.info("Long close: {} {} {} @ {} (slipped from {}) = {}{} (slipped from {}{})", longExchangeName, spread.getCurrencyPair(), tradeVolume.getLongVolume(), longLimitPrice, spread.getLongTicker().getBid().toPlainString(), Currency.USD.getSymbol(), tradeVolume.getLongVolume().multiply(longLimitPrice).toPlainString(), Currency.USD.getSymbol(), tradeVolume.getLongVolume().multiply(spread.getLongTicker().getBid()).toPlainString()); LOGGER.info("Short close: {} {} {} @ {} (slipped from {}) = {}{} (slipped from {}{})", shortExchangeName, spread.getCurrencyPair(), tradeVolume.getShortVolume(), shortLimitPrice, spread.getShortTicker().getAsk().toPlainString(), Currency.USD.getSymbol(), tradeVolume.getShortVolume().multiply(shortLimitPrice).toPlainString(), Currency.USD.getSymbol(), tradeVolume.getShortVolume().multiply(spread.getShortTicker().getAsk()).toPlainString()); <<<<<<< notificationService.sendEmailNotificationBodyForExitTrade(spread, tradeVolume.getLongVolume(), longLimitPrice, tradeVolume.getShortVolume(), shortLimitPrice, activePosition.getEntryBalance(), updatedBalance); ======= notificationService.sendExitTradeNotification(spread, longVolume, longLimitPrice, shortVolume, shortLimitPrice, activePosition.getEntryBalance(), updatedBalance, activePosition.getExitTarget(), isForceCloseCondition, isActivePositionExpired()); >>>>>>> notificationService.sendEmailNotificationBodyForExitTrade(spread, tradeVolume.getLongVolume(), longLimitPrice, tradeVolume.getShortVolume(), shortLimitPrice, activePosition.getEntryBalance(), updatedBalance, activePosition.getExitTarget(), isForceCloseCondition, isActivePositionExpired()); <<<<<<< EntryTradeVolume tradeVolume, BigDecimal longLimitPrice, BigDecimal shortLimitPrice) { ======= BigDecimal longVolume, BigDecimal shortVolume, BigDecimal longLimitPrice, BigDecimal shortLimitPrice, boolean isForcedEntry) { >>>>>>> EntryTradeVolume tradeVolume, BigDecimal longLimitPrice, BigDecimal shortLimitPrice, boolean isForcedEntry) {
<<<<<<< import org.schabi.newpipe.info_list.holder.CommentsInfoItemHolder; import org.schabi.newpipe.info_list.holder.CommentsMiniInfoItemHolder; ======= import org.schabi.newpipe.info_list.holder.ChannelGridInfoItemHolder; >>>>>>> import org.schabi.newpipe.info_list.holder.CommentsInfoItemHolder; import org.schabi.newpipe.info_list.holder.CommentsMiniInfoItemHolder; import org.schabi.newpipe.info_list.holder.ChannelGridInfoItemHolder; <<<<<<< private static final int MINI_COMMENT_HOLDER_TYPE = 0x400; private static final int COMMENT_HOLDER_TYPE = 0x401; ======= private static final int GRID_PLAYLIST_HOLDER_TYPE = 0x302; >>>>>>> private static final int GRID_PLAYLIST_HOLDER_TYPE = 0x302; private static final int MINI_COMMENT_HOLDER_TYPE = 0x400; private static final int COMMENT_HOLDER_TYPE = 0x401; <<<<<<< return useMiniVariant ? MINI_PLAYLIST_HOLDER_TYPE : PLAYLIST_HOLDER_TYPE; case COMMENT: return useMiniVariant ? MINI_COMMENT_HOLDER_TYPE : COMMENT_HOLDER_TYPE; ======= return useGridVariant ? GRID_PLAYLIST_HOLDER_TYPE : useMiniVariant ? MINI_PLAYLIST_HOLDER_TYPE : PLAYLIST_HOLDER_TYPE; >>>>>>> return useGridVariant ? GRID_PLAYLIST_HOLDER_TYPE : useMiniVariant ? MINI_PLAYLIST_HOLDER_TYPE : PLAYLIST_HOLDER_TYPE; case COMMENT: return useMiniVariant ? MINI_COMMENT_HOLDER_TYPE : COMMENT_HOLDER_TYPE; <<<<<<< case MINI_COMMENT_HOLDER_TYPE: return new CommentsMiniInfoItemHolder(infoItemBuilder, parent); case COMMENT_HOLDER_TYPE: return new CommentsInfoItemHolder(infoItemBuilder, parent); ======= case GRID_PLAYLIST_HOLDER_TYPE: return new PlaylistGridInfoItemHolder(infoItemBuilder, parent); >>>>>>> case GRID_PLAYLIST_HOLDER_TYPE: return new PlaylistGridInfoItemHolder(infoItemBuilder, parent); case MINI_COMMENT_HOLDER_TYPE: return new CommentsMiniInfoItemHolder(infoItemBuilder, parent); case COMMENT_HOLDER_TYPE: return new CommentsInfoItemHolder(infoItemBuilder, parent);
<<<<<<< private KeyBindingManager bindingManager = new SimpleKeyBindingManager(); ======= private SimpleCommandMap commandMap = new SimpleCommandMap(this); private SimpleAddonManager addonManager = new SimpleAddonManager(this, commandMap); private Logger log = Logger.getLogger(SpoutClient.class.getName()); private Mode clientMode = Mode.Menu; >>>>>>> private KeyBindingManager bindingManager = new SimpleKeyBindingManager(); private SimpleCommandMap commandMap = new SimpleCommandMap(this); private SimpleAddonManager addonManager = new SimpleAddonManager(this, commandMap); private Logger log = Logger.getLogger(SpoutClient.class.getName()); private Mode clientMode = Mode.Menu; <<<<<<< public void setCamera(Location arg0) { // TODO Auto-generated method stub } @Override public KeyBindingManager getKeyBindingManager() { return bindingManager; } ======= >>>>>>> public void setCamera(Location arg0) { // TODO Auto-generated method stub } @Override public KeyBindingManager getKeyBindingManager() { return bindingManager; }
<<<<<<< for (int dy = y; dy < sizeYOffset; ++dy) { int id = chunkCache.getBlockId(dx, dy, dz); if (id > 0) { //Find the custom texture and addon that created it //TODO a helper method to do this step? ======= for (int dx = x; dx < sizeXOffset; ++dx) { int id = chunkCache.getBlockId(dx, dy, dz); if (id > 0) { >>>>>>> for (int dy = y; dy < sizeYOffset; ++dy) { int id = chunkCache.getBlockId(dx, dy, dz); if (id > 0) { <<<<<<< String customTextureAddon = null; SpoutCustomBlockDesign design = null; if (SpoutItem.isBlockOverride(dx, dy, dz)) { design = SpoutItem.getCustomBlockDesign(dx, dy, dz); } else { int data = chunkCache.getBlockMetadata(dx, dy, dz); design = SpoutItem.getCustomBlockDesign(id, data); ======= String customTexturePlugin = null; GenericBlockDesign design = null; if(SpoutItem.isBlockOverride(dx, dy, dz)) { if(SpoutItem.getBlockOverride(dx, dy, dz) != null ) { design = (GenericBlockDesign) SpoutItem.getBlockOverride(dx, dy, dz).getBlockDesign(); } >>>>>>> String customTextureAddon = null; GenericBlockDesign design = null; if(SpoutItem.isBlockOverride(dx, dy, dz)) { if(SpoutItem.getBlockOverride(dx, dy, dz) != null ) { design = (GenericBlockDesign) SpoutItem.getBlockOverride(dx, dy, dz).getBlockDesign(); } <<<<<<< Block block = Block.blocksList[id]; //Determine which pass this block needs to be rendered on int blockRenderPass = block.getRenderBlockPass(); ======= Block var25 = Block.blocksList[id]; int blockRenderPass = var25.getRenderBlockPass(); >>>>>>> Block block = Block.blocksList[id]; //Determine which pass this block needs to be rendered on int blockRenderPass = block.getRenderBlockPass();
<<<<<<< ======= import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; >>>>>>> import android.support.v7.app.AppCompatActivity; <<<<<<< import org.schabi.newpipe.settings.SettingsActivity; import org.schabi.newpipe.util.NavStack; ======= import org.schabi.newpipe.util.ThemeHelper; >>>>>>> import org.schabi.newpipe.settings.SettingsActivity; import org.schabi.newpipe.util.NavStack; <<<<<<< import static android.os.Build.VERSION.SDK_INT; ======= >>>>>>> import static android.os.Build.VERSION.SDK_INT; import org.schabi.newpipe.util.ThemeHelper; <<<<<<< public class ChannelActivity extends ThemableActivity { private static final String TAG = ChannelActivity.class.toString(); private View rootView = null; ======= public class ChannelActivity extends AppCompatActivity { // intent const public static final String CHANNEL_URL = "channel_url"; public static final String SERVICE_ID = "service_id"; private static final String TAG = ChannelActivity.class.toString(); private View rootView = null; >>>>>>> public class ChannelActivity extends AppCompatActivity { private static final String TAG = ChannelActivity.class.toString(); private View rootView = null; <<<<<<< ======= ThemeHelper.setTheme(this, false); >>>>>>> ThemeHelper.setTheme(this, true);
<<<<<<< import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection; import com.google.android.exoplayer2.trackselection.TrackSelection; ======= import com.google.android.exoplayer2.text.CaptionStyleCompat; >>>>>>> import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection; import com.google.android.exoplayer2.trackselection.TrackSelection; import com.google.android.exoplayer2.text.CaptionStyleCompat;
<<<<<<< } else if (settingsPanel != null) { statisticsUI.setup(currentStatistics); final DialogDescriptor dd = new DialogDescriptor(settingsPanel, NbBundle.getMessage(StatisticsTopComponent.class, "StatisticsFrontEnd.settingsPanel.title", builder.getName())); if (settingsPanel instanceof ValidationPanel) { ValidationPanel vp = (ValidationPanel) settingsPanel; vp.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { dd.setValid(!((ValidationPanel) e.getSource()).isProblem()); } }); } if (DialogDisplayer.getDefault().notify(dd).equals(NotifyDescriptor.OK_OPTION)) { statisticsUI.unsetup(); ======= } else { if (settingsPanel != null) { statisticsUI.setup(currentStatistics); final DialogDescriptor dd = new DialogDescriptor(settingsPanel, NbBundle.getMessage(StatisticsTopComponent.class, "StatisticsFrontEnd.settingsPanel.title", builder.getName())); if (settingsPanel instanceof ValidationPanel) { ValidationPanel vp = (ValidationPanel) settingsPanel; vp.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { dd.setValid(!((ValidationPanel) e.getSource()).isProblem()); } }); } if (DialogDisplayer.getDefault().notify(dd).equals(NotifyDescriptor.OK_OPTION)) { statisticsUI.unsetup(); controllerUI.execute(currentStatistics, listener); } } else { statisticsUI.setup(currentStatistics); >>>>>>> } else if (settingsPanel != null) { statisticsUI.setup(currentStatistics); final DialogDescriptor dd = new DialogDescriptor(settingsPanel, NbBundle.getMessage(StatisticsTopComponent.class, "StatisticsFrontEnd.settingsPanel.title", builder.getName())); if (settingsPanel instanceof ValidationPanel) { ValidationPanel vp = (ValidationPanel) settingsPanel; vp.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { dd.setValid(!((ValidationPanel) e.getSource()).isProblem()); } }); } if (DialogDisplayer.getDefault().notify(dd).equals(NotifyDescriptor.OK_OPTION)) { statisticsUI.unsetup();
<<<<<<< import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables; ======= import org.checkerframework.checker.nullness.qual.Nullable; >>>>>>> import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables; import org.checkerframework.checker.nullness.qual.Nullable;
<<<<<<< import org.apache.beam.sdk.extensions.sql.impl.rule.BeamFilterRule; import org.apache.beam.sdk.extensions.sql.impl.rule.BeamIOSinkRule; ======= >>>>>>> import org.apache.beam.sdk.extensions.sql.impl.rule.BeamFilterRule; import org.apache.beam.sdk.extensions.sql.impl.rule.BeamIOSinkRule; <<<<<<< import org.apache.calcite.rel.core.RelFactories; import org.apache.calcite.rel.rules.AggregateJoinTransposeRule; import org.apache.calcite.rel.rules.AggregateRemoveRule; import org.apache.calcite.rel.rules.AggregateUnionAggregateRule; import org.apache.calcite.rel.rules.FilterAggregateTransposeRule; import org.apache.calcite.rel.rules.FilterJoinRule; import org.apache.calcite.rel.rules.FilterProjectTransposeRule; import org.apache.calcite.rel.rules.FilterSetOpTransposeRule; import org.apache.calcite.rel.rules.JoinPushExpressionsRule; import org.apache.calcite.rel.rules.ProjectFilterTransposeRule; import org.apache.calcite.rel.rules.ProjectJoinTransposeRule; import org.apache.calcite.rel.rules.ProjectMergeRule; import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; import org.apache.calcite.rel.rules.ProjectSortTransposeRule; import org.apache.calcite.rel.rules.PruneEmptyRules; import org.apache.calcite.rel.rules.PushProjector; import org.apache.calcite.rel.rules.SortProjectTransposeRule; import org.apache.calcite.rel.rules.SortRemoveRule; import org.apache.calcite.rel.rules.UnionEliminatorRule; import org.apache.calcite.rel.rules.UnionToDistinctRule; ======= import org.apache.calcite.rel.rules.CalcMergeRule; import org.apache.calcite.rel.rules.FilterCalcMergeRule; import org.apache.calcite.rel.rules.FilterToCalcRule; import org.apache.calcite.rel.rules.ProjectCalcMergeRule; import org.apache.calcite.rel.rules.ProjectToCalcRule; >>>>>>> import org.apache.calcite.rel.core.RelFactories; import org.apache.calcite.rel.rules.AggregateJoinTransposeRule; import org.apache.calcite.rel.rules.AggregateRemoveRule; import org.apache.calcite.rel.rules.AggregateUnionAggregateRule; import org.apache.calcite.rel.rules.FilterAggregateTransposeRule; import org.apache.calcite.rel.rules.FilterJoinRule; import org.apache.calcite.rel.rules.FilterProjectTransposeRule; import org.apache.calcite.rel.rules.FilterSetOpTransposeRule; import org.apache.calcite.rel.rules.JoinPushExpressionsRule; import org.apache.calcite.rel.rules.ProjectFilterTransposeRule; import org.apache.calcite.rel.rules.ProjectJoinTransposeRule; import org.apache.calcite.rel.rules.ProjectMergeRule; import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; import org.apache.calcite.rel.rules.ProjectSortTransposeRule; import org.apache.calcite.rel.rules.PruneEmptyRules; import org.apache.calcite.rel.rules.PushProjector; import org.apache.calcite.rel.rules.SortProjectTransposeRule; import org.apache.calcite.rel.rules.SortRemoveRule; import org.apache.calcite.rel.rules.UnionEliminatorRule; import org.apache.calcite.rel.rules.UnionToDistinctRule; import org.apache.calcite.rel.rules.CalcMergeRule; import org.apache.calcite.rel.rules.FilterCalcMergeRule; import org.apache.calcite.rel.rules.FilterToCalcRule; import org.apache.calcite.rel.rules.ProjectCalcMergeRule; import org.apache.calcite.rel.rules.ProjectToCalcRule; <<<<<<< public static final List<RelOptRule> BEAM_CONVERSIONS = ImmutableList.of( ======= private static final List<RelOptRule> LOGICAL_OPTIMIZATIONS = ImmutableList.of( // Rules so we only have to implement Calc FilterCalcMergeRule.INSTANCE, ProjectCalcMergeRule.INSTANCE, FilterToCalcRule.INSTANCE, ProjectToCalcRule.INSTANCE, // https://issues.apache.org/jira/browse/BEAM-4522 // CalcRemoveRule.INSTANCE, CalcMergeRule.INSTANCE); private static final List<RelOptRule> BEAM_CONVERTERS = ImmutableList.of( BeamCalcRule.INSTANCE, >>>>>>> private static final List<RelOptRule> LOGICAL_OPTIMIZATIONS = ImmutableList.of( // Rules so we only have to implement Calc FilterCalcMergeRule.INSTANCE, ProjectCalcMergeRule.INSTANCE, FilterToCalcRule.INSTANCE, ProjectToCalcRule.INSTANCE, // https://issues.apache.org/jira/browse/BEAM-4522 // CalcRemoveRule.INSTANCE, CalcMergeRule.INSTANCE// push a filter into a join FilterJoinRule.FILTER_ON_JOIN, // push filter into the children of a join FilterJoinRule.JOIN, // push filter through an aggregation FilterAggregateTransposeRule.INSTANCE, // push filter through set operation FilterSetOpTransposeRule.INSTANCE, // push project through set operation ProjectSetOpTransposeRule.INSTANCE, // push a projection past a filter or vice versa ProjectFilterTransposeRule.INSTANCE, FilterProjectTransposeRule.INSTANCE, // push a projection to the children of a join // push all expressions to handle the time indicator correctly new ProjectJoinTransposeRule( PushProjector.ExprCondition.FALSE, RelFactories.LOGICAL_BUILDER), // merge projections ProjectMergeRule.INSTANCE, // reorder sort and projection SortProjectTransposeRule.INSTANCE, ProjectSortTransposeRule.INSTANCE, // join rules JoinPushExpressionsRule.INSTANCE, // remove union with only a single child UnionEliminatorRule.INSTANCE, // convert non-all union into all-union + distinct UnionToDistinctRule.INSTANCE, // remove aggregation if it does not aggregate and input is already distinct AggregateRemoveRule.INSTANCE, // push aggregate through join AggregateJoinTransposeRule.EXTENDED, // aggregate union rule AggregateUnionAggregateRule.INSTANCE, // remove unnecessary sort rule SortRemoveRule.INSTANCE, // prune empty results rules PruneEmptyRules.AGGREGATE_INSTANCE, PruneEmptyRules.FILTER_INSTANCE, PruneEmptyRules.JOIN_LEFT_INSTANCE, PruneEmptyRules.JOIN_RIGHT_INSTANCE, PruneEmptyRules.PROJECT_INSTANCE, PruneEmptyRules.SORT_INSTANCE, PruneEmptyRules.UNION_INSTANCE); private static final List<RelOptRule> BEAM_CONVERTERS = ImmutableList.of( BeamCalcRule.INSTANCE, <<<<<<< BeamUnnestRule.INSTANCE, BeamJoinRule.INSTANCE, BeamEnumerableConverterRule.INSTANCE, BeamValuesRule.INSTANCE); public static final List<RelOptRule> CALCITE_LOGICAL_OPTIMIZATIONS = ImmutableList.of( // push a filter into a join FilterJoinRule.FILTER_ON_JOIN, // push filter into the children of a join FilterJoinRule.JOIN, // push filter through an aggregation FilterAggregateTransposeRule.INSTANCE, // push filter through set operation FilterSetOpTransposeRule.INSTANCE, // push project through set operation ProjectSetOpTransposeRule.INSTANCE, // push a projection past a filter or vice versa ProjectFilterTransposeRule.INSTANCE, FilterProjectTransposeRule.INSTANCE, // push a projection to the children of a join // push all expressions to handle the time indicator correctly new ProjectJoinTransposeRule( PushProjector.ExprCondition.FALSE, RelFactories.LOGICAL_BUILDER), // merge projections ProjectMergeRule.INSTANCE, // reorder sort and projection SortProjectTransposeRule.INSTANCE, ProjectSortTransposeRule.INSTANCE, // join rules JoinPushExpressionsRule.INSTANCE, // remove union with only a single child UnionEliminatorRule.INSTANCE, // convert non-all union into all-union + distinct UnionToDistinctRule.INSTANCE, // remove aggregation if it does not aggregate and input is already distinct AggregateRemoveRule.INSTANCE, // push aggregate through join AggregateJoinTransposeRule.EXTENDED, // aggregate union rule AggregateUnionAggregateRule.INSTANCE, // remove unnecessary sort rule SortRemoveRule.INSTANCE, // prune empty results rules PruneEmptyRules.AGGREGATE_INSTANCE, PruneEmptyRules.FILTER_INSTANCE, PruneEmptyRules.JOIN_LEFT_INSTANCE, PruneEmptyRules.JOIN_RIGHT_INSTANCE, PruneEmptyRules.PROJECT_INSTANCE, PruneEmptyRules.SORT_INSTANCE, PruneEmptyRules.UNION_INSTANCE); public static RuleSet[] getRuleSets() { return new RuleSet[] { RuleSets.ofList( ImmutableList.<RelOptRule>builder() .addAll(CALCITE_LOGICAL_OPTIMIZATIONS) .addAll(BEAM_CONVERSIONS) .build()) ======= BeamJoinRule.INSTANCE); private static final List<RelOptRule> BEAM_TO_ENUMERABLE = ImmutableList.of(BeamEnumerableConverterRule.INSTANCE); public static RuleSet[] getRuleSets() { return new RuleSet[] { RuleSets.ofList( ImmutableList.<RelOptRule>builder() .addAll(LOGICAL_OPTIMIZATIONS) .addAll(BEAM_CONVERTERS) .addAll(BEAM_TO_ENUMERABLE) .build()) >>>>>>> BeamUnnestRule.INSTANCE, BeamJoinRule.INSTANCE, BeamEnumerableConverterRule.INSTANCE, BeamValuesRule.INSTANCE); private static final List<RelOptRule> BEAM_TO_ENUMERABLE = ImmutableList.of(BeamEnumerableConverterRule.INSTANCE); public static RuleSet[] getRuleSets() { return new RuleSet[] { RuleSets.ofList( ImmutableList.<RelOptRule>builder() .addAll(BEAM_CONVERSIONS) .addAll(BEAM_TO_ENUMERABLE) .addAll(LOGICAL_OPTIMIZATIONS) .build())
<<<<<<< import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.util.NavStack; ======= import org.schabi.newpipe.util.ThemeHelper; >>>>>>> import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.util.NavStack; import org.schabi.newpipe.util.ThemeHelper;
<<<<<<< import android.provider.Settings; ======= import android.view.accessibility.CaptioningManager; >>>>>>> import android.provider.Settings; import android.view.accessibility.CaptioningManager; <<<<<<< @Retention(SOURCE) @IntDef({MINIMIZE_ON_EXIT_MODE_NONE, MINIMIZE_ON_EXIT_MODE_BACKGROUND, MINIMIZE_ON_EXIT_MODE_POPUP}) public @interface MinimizeMode { int MINIMIZE_ON_EXIT_MODE_NONE = 0; int MINIMIZE_ON_EXIT_MODE_BACKGROUND = 1; int MINIMIZE_ON_EXIT_MODE_POPUP = 2; } @Retention(SOURCE) @IntDef({AUTOPLAY_TYPE_ALWAYS, AUTOPLAY_TYPE_WIFI, AUTOPLAY_TYPE_NEVER}) public @interface AutoplayType { int AUTOPLAY_TYPE_ALWAYS = 0; int AUTOPLAY_TYPE_WIFI = 1; int AUTOPLAY_TYPE_NEVER = 2; } ======= >>>>>>> <<<<<<< if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return 1.0f; ======= if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return 1f; } >>>>>>> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return 1f; } <<<<<<< private static String getAutoplayType(@NonNull final Context context, final String key) { return getPreferences(context).getString(context.getString(R.string.autoplay_key), key); } private static SinglePlayQueue getAutoQueuedSinglePlayQueue(StreamInfoItem streamInfoItem) { ======= private static SinglePlayQueue getAutoQueuedSinglePlayQueue( final StreamInfoItem streamInfoItem) { >>>>>>> private static String getAutoplayType(@NonNull final Context context, final String key) { return getPreferences(context).getString(context.getString(R.string.autoplay_key), key); } private static SinglePlayQueue getAutoQueuedSinglePlayQueue( final StreamInfoItem streamInfoItem) {
<<<<<<< public void initViews(View rootView) { this.rootView = rootView; this.surfaceView = rootView.findViewById(R.id.surfaceView); this.surfaceForeground = rootView.findViewById(R.id.surfaceForeground); this.loadingPanel = rootView.findViewById(R.id.loading_panel); this.endScreen = rootView.findViewById(R.id.endScreen); this.controlAnimationView = rootView.findViewById(R.id.controlAnimationView); this.controlsRoot = rootView.findViewById(R.id.playbackControlRoot); this.currentDisplaySeek = rootView.findViewById(R.id.currentDisplaySeek); this.playbackSeekBar = rootView.findViewById(R.id.playbackSeekBar); this.playbackCurrentTime = rootView.findViewById(R.id.playbackCurrentTime); this.playbackEndTime = rootView.findViewById(R.id.playbackEndTime); this.playbackLiveSync = rootView.findViewById(R.id.playbackLiveSync); this.playbackSpeedTextView = rootView.findViewById(R.id.playbackSpeed); this.bottomControlsRoot = rootView.findViewById(R.id.bottomControls); this.topControlsRoot = rootView.findViewById(R.id.topControls); this.qualityTextView = rootView.findViewById(R.id.qualityTextView); this.subtitleView = rootView.findViewById(R.id.subtitleView); ======= public void initViews(final View view) { this.rootView = view; this.aspectRatioFrameLayout = view.findViewById(R.id.aspectRatioLayout); this.surfaceView = view.findViewById(R.id.surfaceView); this.surfaceForeground = view.findViewById(R.id.surfaceForeground); this.loadingPanel = view.findViewById(R.id.loading_panel); this.endScreen = view.findViewById(R.id.endScreen); this.controlAnimationView = view.findViewById(R.id.controlAnimationView); this.controlsRoot = view.findViewById(R.id.playbackControlRoot); this.currentDisplaySeek = view.findViewById(R.id.currentDisplaySeek); this.playbackSeekBar = view.findViewById(R.id.playbackSeekBar); this.playbackCurrentTime = view.findViewById(R.id.playbackCurrentTime); this.playbackEndTime = view.findViewById(R.id.playbackEndTime); this.playbackLiveSync = view.findViewById(R.id.playbackLiveSync); this.playbackSpeedTextView = view.findViewById(R.id.playbackSpeed); this.bottomControlsRoot = view.findViewById(R.id.bottomControls); this.topControlsRoot = view.findViewById(R.id.topControls); this.qualityTextView = view.findViewById(R.id.qualityTextView); this.subtitleView = view.findViewById(R.id.subtitleView); >>>>>>> public void initViews(final View view) { this.rootView = view; this.surfaceView = view.findViewById(R.id.surfaceView); this.surfaceForeground = view.findViewById(R.id.surfaceForeground); this.loadingPanel = view.findViewById(R.id.loading_panel); this.endScreen = view.findViewById(R.id.endScreen); this.controlAnimationView = view.findViewById(R.id.controlAnimationView); this.controlsRoot = view.findViewById(R.id.playbackControlRoot); this.currentDisplaySeek = view.findViewById(R.id.currentDisplaySeek); this.playbackSeekBar = view.findViewById(R.id.playbackSeekBar); this.playbackCurrentTime = view.findViewById(R.id.playbackCurrentTime); this.playbackEndTime = view.findViewById(R.id.playbackEndTime); this.playbackLiveSync = view.findViewById(R.id.playbackLiveSync); this.playbackSpeedTextView = view.findViewById(R.id.playbackSpeed); this.bottomControlsRoot = view.findViewById(R.id.bottomControls); this.topControlsRoot = view.findViewById(R.id.topControls); this.qualityTextView = view.findViewById(R.id.qualityTextView); this.subtitleView = view.findViewById(R.id.subtitleView); <<<<<<< this.resizeView = rootView.findViewById(R.id.resizeTextView); resizeView.setText(PlayerHelper.resizeTypeOf(context, getSurfaceView().getResizeMode())); ======= this.resizeView = view.findViewById(R.id.resizeTextView); resizeView.setText(PlayerHelper .resizeTypeOf(context, aspectRatioFrameLayout.getResizeMode())); >>>>>>> this.resizeView = view.findViewById(R.id.resizeTextView); resizeView.setText(PlayerHelper .resizeTypeOf(context, getSurfaceView().getResizeMode())); <<<<<<< if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) ======= //this.aspectRatioFrameLayout.setAspectRatio(16.0f / 9.0f); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { >>>>>>> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { <<<<<<< ======= if (simpleExoPlayer.getCurrentPosition() != 0 && !isControlsVisible()) { controlsVisibilityHandler.removeCallbacksAndMessages(null); controlsVisibilityHandler .postDelayed(this::showControlsThenHide, DEFAULT_CONTROLS_DURATION); } >>>>>>> <<<<<<< float scaleFrom = goneOnEnd ? 1.0f : 1.0f, scaleTo = goneOnEnd ? 1.8f : 1.4f; float alphaFrom = goneOnEnd ? 1.0f : 0.0f, alphaTo = goneOnEnd ? 0.0f : 1.0f; ======= float scaleFrom = goneOnEnd ? 1f : 1f; float scaleTo = goneOnEnd ? 1.8f : 1.4f; float alphaFrom = goneOnEnd ? 1f : 0f; float alphaTo = goneOnEnd ? 0f : 1f; >>>>>>> float scaleFrom = goneOnEnd ? 1f : 1f; float scaleTo = goneOnEnd ? 1.8f : 1.4f; float alphaFrom = goneOnEnd ? 1f : 0f; float alphaTo = goneOnEnd ? 0f : 1f; <<<<<<< public ExpandableSurfaceView getSurfaceView() { ======= public void setPlaybackQuality(final String quality) { this.resolver.setPlaybackQuality(quality); } public AspectRatioFrameLayout getAspectRatioFrameLayout() { return aspectRatioFrameLayout; } public SurfaceView getSurfaceView() { >>>>>>> public void setPlaybackQuality(final String quality) { this.resolver.setPlaybackQuality(quality); } public ExpandableSurfaceView getSurfaceView() {
<<<<<<< import org.schabi.newpipe.extractor.AudioStream; ======= >>>>>>> import org.schabi.newpipe.extractor.AudioStream;
<<<<<<< public static final int DPAD_CONTROLS_HIDE_TIME = 7000; // 7 Seconds ======= protected static final int RENDERER_UNAVAILABLE = -1; @NonNull private final VideoPlaybackResolver resolver; >>>>>>> public static final int DPAD_CONTROLS_HIDE_TIME = 7000; // 7 Seconds protected static final int RENDERER_UNAVAILABLE = -1; @NonNull private final VideoPlaybackResolver resolver; <<<<<<< if (DEBUG) Log.d(TAG, "showControlsThenHide() called"); final int hideTime = controlsRoot.isInTouchMode() ? DEFAULT_CONTROLS_HIDE_TIME : DPAD_CONTROLS_HIDE_TIME; animateView(controlsRoot, true, DEFAULT_CONTROLS_DURATION, 0, () -> hideControls(DEFAULT_CONTROLS_DURATION, hideTime)); ======= if (DEBUG) { Log.d(TAG, "showControlsThenHide() called"); } animateView(controlsRoot, true, DEFAULT_CONTROLS_DURATION, 0, () -> hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME)); >>>>>>> if (DEBUG) { Log.d(TAG, "showControlsThenHide() called"); } final int hideTime = controlsRoot.isInTouchMode() ? DEFAULT_CONTROLS_HIDE_TIME : DPAD_CONTROLS_HIDE_TIME; animateView(controlsRoot, true, DEFAULT_CONTROLS_DURATION, 0, () -> hideControls(DEFAULT_CONTROLS_DURATION, hideTime)); <<<<<<< public void safeHideControls(final long duration, long delay) { if (DEBUG) Log.d(TAG, "safeHideControls() called with: delay = [" + delay + "]"); if (rootView.isInTouchMode()) { controlsVisibilityHandler.removeCallbacksAndMessages(null); controlsVisibilityHandler.postDelayed( () -> animateView(controlsRoot, false, duration), delay); } } public void hideControls(final long duration, long delay) { if (DEBUG) Log.d(TAG, "hideControls() called with: delay = [" + delay + "]"); ======= public void hideControls(final long duration, final long delay) { if (DEBUG) { Log.d(TAG, "hideControls() called with: delay = [" + delay + "]"); } >>>>>>> public void safeHideControls(final long duration, final long delay) { if (DEBUG) { Log.d(TAG, "safeHideControls() called with: delay = [" + delay + "]"); } if (rootView.isInTouchMode()) { controlsVisibilityHandler.removeCallbacksAndMessages(null); controlsVisibilityHandler.postDelayed( () -> animateView(controlsRoot, false, duration), delay); } } public void hideControls(final long duration, final long delay) { if (DEBUG) { Log.d(TAG, "hideControls() called with: delay = [" + delay + "]"); }
<<<<<<< import org.junit.Test; import org.junit.Ignore; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; ======= >>>>>>> <<<<<<< /** * Verify that security disabling feature works properly. * * 1. try to hit url with invalid certificate and evaluate that exception is thrown * 2. disable security checks and call the same url to verify that content is consumed correctly * * @throws Exception */ @Test public void testUnsafe() throws Exception { String url = "https://certs.cac.washington.edu/CAtest/"; try { Jsoup.connect(url).execute(); } catch (IOException e) { // that's expected exception } Connection.Response defaultRes = Jsoup.connect(url).setSecure(false).execute(); assertThat(defaultRes.statusCode(),is(200)); } ======= @Test public void shouldWorkForCharsetInExtraAttribute() throws IOException { Connection.Response res = Jsoup.connect("https://www.creditmutuel.com/groupe/fr/").execute(); Document doc = res.parse(); // would throw an error if charset unsupported assertEquals("ISO-8859-1", res.charset()); } // The following tests were added to test specific domains if they work. All code paths // which make the following test green are tested in other unit or integration tests, so the following lines // could be deleted @Test public void shouldSelectFirstCharsetOnWeirdMultileCharsetsInMetaTags() throws IOException { Connection.Response res = Jsoup.connect("http://aamo.info/").execute(); res.parse(); // would throw an error if charset unsupported assertEquals("ISO-8859-1", res.charset()); } @Test public void shouldParseBrokenHtml5MetaCharsetTagCorrectly() throws IOException { Connection.Response res = Jsoup.connect("http://9kuhkep.net").execute(); res.parse(); // would throw an error if charset unsupported assertEquals("UTF-8", res.charset()); } @Test public void shouldEmptyMetaCharsetCorrectly() throws IOException { Connection.Response res = Jsoup.connect("http://aastmultimedia.com").execute(); res.parse(); // would throw an error if charset unsupported assertEquals("UTF-8", res.charset()); } @Test public void shouldWorkForDuplicateCharsetInTag() throws IOException { Connection.Response res = Jsoup.connect("http://aaptsdassn.org").execute(); Document doc = res.parse(); // would throw an error if charset unsupported assertEquals("ISO-8859-1", res.charset()); } >>>>>>> /** * Verify that security disabling feature works properly. * * 1. try to hit url with invalid certificate and evaluate that exception is thrown * 2. disable security checks and call the same url to verify that content is consumed correctly * * @throws Exception */ @Test public void testUnsafe() throws Exception { String url = "https://certs.cac.washington.edu/CAtest/"; try { Jsoup.connect(url).execute(); } catch (IOException e) { // that's expected exception } Connection.Response defaultRes = Jsoup.connect(url).setSecure(false).execute(); assertThat(defaultRes.statusCode(),is(200)); } @Test public void shouldWorkForCharsetInExtraAttribute() throws IOException { Connection.Response res = Jsoup.connect("https://www.creditmutuel.com/groupe/fr/").execute(); Document doc = res.parse(); // would throw an error if charset unsupported assertEquals("ISO-8859-1", res.charset()); } // The following tests were added to test specific domains if they work. All code paths // which make the following test green are tested in other unit or integration tests, so the following lines // could be deleted @Test public void shouldSelectFirstCharsetOnWeirdMultileCharsetsInMetaTags() throws IOException { Connection.Response res = Jsoup.connect("http://aamo.info/").execute(); res.parse(); // would throw an error if charset unsupported assertEquals("ISO-8859-1", res.charset()); } @Test public void shouldParseBrokenHtml5MetaCharsetTagCorrectly() throws IOException { Connection.Response res = Jsoup.connect("http://9kuhkep.net").execute(); res.parse(); // would throw an error if charset unsupported assertEquals("UTF-8", res.charset()); } @Test public void shouldEmptyMetaCharsetCorrectly() throws IOException { Connection.Response res = Jsoup.connect("http://aastmultimedia.com").execute(); res.parse(); // would throw an error if charset unsupported assertEquals("UTF-8", res.charset()); } @Test public void shouldWorkForDuplicateCharsetInTag() throws IOException { Connection.Response res = Jsoup.connect("http://aaptsdassn.org").execute(); Document doc = res.parse(); // would throw an error if charset unsupported assertEquals("ISO-8859-1", res.charset()); }
<<<<<<< ======= private static final Logger LOGGER = LoggerFactory.getLogger(AdaptiveScalarEncoder.class); /* * This is an implementation of the scalar encoder that adapts the min and * max of the scalar encoder dynamically. This is essential to the streaming * model of the online prediction framework. * * Initialization of an adapive encoder using resolution or radius is not * supported; it must be intitialized with n. This n is kept constant while * the min and max of the encoder changes. * * The adaptive encoder must be have periodic set to false. * * The adaptive encoder may be initialized with a minval and maxval or with * `None` for each of these. In the latter case, the min and max are set as * the 1st and 99th percentile over a window of the past 100 records. * * *Note:** the sliding window may record duplicates of the values in the * dataset, and therefore does not reflect the statistical distribution of * the input data and may not be used to calculate the median, mean etc. */ >>>>>>> private static final Logger LOGGER = LoggerFactory.getLogger(AdaptiveScalarEncoder.class); <<<<<<< /** * {@inheritDoc} ======= /* * (non-Javadoc) * * @see org.numenta.nupic.encoders.ScalarEncoder#init() >>>>>>> /** * {@inheritDoc} * * @see org.numenta.nupic.encoders.ScalarEncoder#init() <<<<<<< /** * {@inheritDoc} ======= /* * (non-Javadoc) * * @see org.numenta.nupic.encoders.ScalarEncoder#initEncoder(int, double, * double, int, double, double) >>>>>>> /** * {@inheritDoc} * * @see org.numenta.nupic.encoders.ScalarEncoder#initEncoder(int, double, * double, int, double, double)
<<<<<<< import org.n52.iceland.ogc.ows.OwsExceptionReport; import org.n52.iceland.service.ServiceConstants.SupportedType; ======= import org.n52.iceland.service.ServiceConstants.SupportedTypeKey; >>>>>>> import org.n52.iceland.service.ServiceConstants.SupportedType; <<<<<<< * * @author Carsten Hollmann <[email protected]> ======= * * @author <a href="mailto:[email protected]">Carsten Hollmann</a> >>>>>>> * * @author <a href="mailto:[email protected]">Carsten Hollmann</a>
<<<<<<< private XRefreshView mContainer; ======= private OnScrollListener mScrollListener; >>>>>>> private XRefreshView mContainer; private OnScrollListener mScrollListener; <<<<<<< if (mContainer!=null&&scrollState == OnScrollListener.SCROLL_STATE_IDLE && mTotalItemCount - 1 == view.getLastVisiblePosition()) { mContainer.invoketLoadMore(); } ======= if (mScrollListener != null) { mScrollListener.onScrollStateChanged(view, scrollState); } >>>>>>> if (mContainer!=null&&scrollState == OnScrollListener.SCROLL_STATE_IDLE && mTotalItemCount - 1 == view.getLastVisiblePosition()) { mContainer.invoketLoadMore(); } if (mScrollListener != null) { mScrollListener.onScrollStateChanged(view, scrollState); }
<<<<<<< final static Iterable<? extends Module> NETTY_MODULES = ImmutableSet.of(new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(), new NettyPayloadModule()); ======= final static Iterable<? extends Module> MODULES = ImmutableSet.of(new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(), new NettyPayloadModule()); // ImmutableSet.of(new NingHttpCommandExecutorServiceModule(), new SLF4JLoggingModule()); >>>>>>> final static Iterable<? extends Module> MODULES = ImmutableSet.of(new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(), new NettyPayloadModule()); <<<<<<< long length = input.length(); ======= long length = input.length(); >>>>>>> long length = input.length(); <<<<<<< Blob blob = blobStore.blobBuilder(objectName).payload(input) .contentType(MediaType.APPLICATION_OCTET_STREAM).contentDisposition(objectName).build(); ======= Blob blob = blobStore.blobBuilder(objectName).payload(input).contentType(MediaType.APPLICATION_OCTET_STREAM) .contentDisposition(objectName).build(); >>>>>>> Blob blob = blobStore.blobBuilder(objectName).payload(input) .contentType(MediaType.APPLICATION_OCTET_STREAM).contentDisposition(objectName).build();
<<<<<<< Optional<NameLink> iteratorFuncOpt = forIn.attrIteratorFunc(); Optional<NameLink> nextFuncOpt = forIn.attrGetNextFunc(); Optional<NameLink> hasNextFuncOpt = forIn.attrHasNextFunc(); ======= Optional<FuncLink> iteratorFuncOpt = s.attrIteratorFunc(); Optional<FuncLink> nextFuncOpt = s.attrGetNextFunc(); Optional<FuncLink> hasNextFuncOpt = s.attrHasNextFunc(); >>>>>>> Optional<FuncLink> iteratorFuncOpt = forIn.attrIteratorFunc(); Optional<FuncLink> nextFuncOpt = forIn.attrGetNextFunc(); Optional<FuncLink> hasNextFuncOpt = forIn.attrHasNextFunc(); <<<<<<< WurstType nextReturn = nextFunc.getReturnType().setTypeArgs(iteratorType.getTypeArgBinding()); ImExpr nextCallWrapped = ExprTranslation.wrapTranslation(forIn, t, nextCall, nextReturn, loopVarType); ======= WurstType nextReturn = nextFunc.getReturnType(); ImExpr nextCallWrapped = ExprTranslation.wrapTranslation(s, t, nextCall, nextReturn, loopVarType); >>>>>>> WurstType nextReturn = nextFunc.getReturnType(); ImExpr nextCallWrapped = ExprTranslation.wrapTranslation(forIn, t, nextCall, nextReturn, loopVarType);
<<<<<<< ======= * The address of XMPP server to which the focus user will connect to. */ private final String serverAddress; /** * The name of XMPP domain used by the focus user to login. */ private final String xmppDomain; /** * The name of XMPP user used by the focus to login. */ private final String xmppUsername; /** * The password user by the focus to login * (if null then will login anonymously). */ private final String xmppLoginPassword; /** >>>>>>> <<<<<<< String focusUserName, ProtocolProviderHandler protocolProviderHandler, ======= String serverAddress, String xmppDomain, String xmppUsername, String xmppLoginPassword, >>>>>>> String focusUserName, ProtocolProviderHandler protocolProviderHandler, <<<<<<< this.focusUserName = focusUserName; this.protocolProviderHandler = protocolProviderHandler; ======= this.serverAddress = serverAddress; this.xmppDomain = xmppDomain != null ? xmppDomain : serverAddress; this.xmppUsername = xmppUsername; this.xmppLoginPassword = xmppLoginPassword; >>>>>>> this.focusUserName = focusUserName; this.protocolProviderHandler = protocolProviderHandler; <<<<<<< ======= started = true; protocolProviderHandler.start( serverAddress, xmppDomain, xmppLoginPassword, xmppUsername, this); >>>>>>> started = true; <<<<<<< if (protocolProviderHandler.isRegistered()) ======= // Set pre-configured SIP gateway if (config.getPreConfiguredSipGateway() != null) { services.setSipGateway(config.getPreConfiguredSipGateway()); } if (!protocolProviderHandler.isRegistered()) >>>>>>> // Set pre-configured SIP gateway if (config.getPreConfiguredSipGateway() != null) { services.setSipGateway(config.getPreConfiguredSipGateway()); } if (protocolProviderHandler.isRegistered()) <<<<<<< // Invite peer takes time because of channel allocation, so schedule // this on separate thread FocusBundleActivator .getSharedThreadPool() .submit(new Runnable() { @Override public void run() { inviteChatMember(chatRoomMember); } }); ======= // Invite all not invited yet if (participants.size() == 0) { for (final ChatRoomMember member : chatRoom.getMembers()) { inviteChatMember(member); } } // Only the one who has just joined else { inviteChatMember(chatRoomMember); } >>>>>>> // FIXME: verify if (colibriConference == null) { colibriConference = colibri.createNewConference(); colibriConference.setConfig(config); } // Invite all not invited yet if (participants.size() == 0) { for (final ChatRoomMember member : chatRoom.getMembers()) { inviteChatMember(member); } } // Only the one who has just joined else { inviteChatMember(chatRoomMember); } <<<<<<< boolean conferenceExists = colibriConference.getConferenceId() != null; ======= >>>>>>> <<<<<<< else { // Try next bridge colibriConference .setJitsiVideobridge(bridgesIterator.next()); } ======= >>>>>>> <<<<<<< * Initializes the conference by inviting first participants. * * @return <tt>false</tt> if it's too early to start, or <tt>true</tt> * if the conference has started. */ private synchronized boolean initConference() { if (!checkAtLeastTwoParticipants()) return false; if (colibriConference == null) { colibriConference = colibri.createNewConference(); colibriConference.setConfig(config); } for (ChatRoomMember member : chatRoom.getMembers()) { inviteChatMember(member); } return true; } /** ======= >>>>>>> * Initializes the conference by inviting first participants. * * @return <tt>false</tt> if it's too early to start, or <tt>true</tt> * if the conference has started. */ private boolean initConference() { if (!checkAtLeastTwoParticipants()) return false; for (ChatRoomMember member : chatRoom.getMembers()) { inviteChatMember(member); } return true; } /** <<<<<<< colibriConference .expireChannels(leftPeer.getColibriChannelsInfo()); ======= logger.info("Expiring channels for: " + contactAddress); colibri.expireChannels(leftPeer.getColibriChannelsInfo()); >>>>>>> logger.info("Expiring channels for: " + contactAddress); colibriConference.expireChannels( leftPeer.getColibriChannelsInfo()); <<<<<<< if (RegistrationState.REGISTERED.equals(evt.getNewState())) { //FIXME: verify if it's ok getDirectXmppOpSet().addPacketHandler( messageListener, new AndFilter( new MessageTypeFilter(Message.Type.normal), new ToContainsFilter(getFocusJid()))); } if (chatRoom == null) { joinTheRoom(); } // We're not interested in event other that REGISTERED protocolProviderHandler.removeRegistrationListener(this); ======= maybeJoinTheRoom(); >>>>>>> if (RegistrationState.REGISTERED.equals(evt.getNewState())) { if (chatRoom == null) { joinTheRoom(); } // We're not interested in event other that REGISTERED protocolProviderHandler.removeRegistrationListener(this); } <<<<<<< colibriConference.updateSsrcGroupsInfo( ======= colibri.updateSourcesInfo( participant.getSSRCsCopy(), >>>>>>> colibriConference.updateSourcesInfo( participant.getSSRCsCopy(), <<<<<<< colibriConference.updateSsrcGroupsInfo( ======= colibri.updateSourcesInfo( participant.getSSRCsCopy(), >>>>>>> colibriConference.updateSourcesInfo( participant.getSSRCsCopy(), <<<<<<< return roomName + "/" + focusUserName; ======= return chatRoom != null ? chatRoom.getName() + "/" + xmppUsername : null; >>>>>>> return roomName + "/" + focusUserName; <<<<<<< /** * The <tt>LoggingService</tt> which will be used to log the events * (usually to an InfluxDB instance). */ private LoggingService loggingService = null; /** * Whether {@link #loggingService} has been initialized or not. */ private boolean loggingServiceSet = false; /** * The string which identifies the contents of a log message as containg * PeerConnection statistics. */ private static final String LOG_ID_PC_STATS = "PeerConnectionStats"; /** * Processes a packet. Looks for known extensions (XEP-0337 "log" * extensions) and handles them. * @param packet the packet to process. */ @Override public void processPacket(Packet packet) { if (!(packet instanceof Message)) return; Message message = (Message) packet; LogPacketExtension log = null; for (PacketExtension ext : message.getExtensions()) { if (ext instanceof LogPacketExtension) { log = (LogPacketExtension) ext; break; } } if (log != null) { Participant participant = findParticipantForRoomJid(message.getFrom()); if (participant != null) { handleLogRequest(log, participant); } else { logger.info("Ignoring log request from unknown JID: " + message.getFrom()); } } } /** * Handles a <tt>LogPacketExtension</tt> which represents a request * from a specific <tt>Participant</tt> to log a message. * @param log the <tt>LogPacketExtension</tt> to handle. * @param participant the <tt>Participant</tt> which sent the request. */ private void handleLogRequest( LogPacketExtension log, Participant participant) { LoggingService loggingService = getLoggingService(); if (loggingService != null) { if (LOG_ID_PC_STATS.equals(log.getID())) { String content = getContent(log); if (content != null) { loggingService.logEvent( LogEventFactory.peerConnectionStats( colibriConference.getConferenceId(), participant.getChatMember().getName(), content)); } } else { if (logger.isInfoEnabled()) logger.info("Ignoring log request with an unknown ID:" + log.getID()); } } } /** * Gets the <tt>LoggingService</tt>. * @return the <tt>LoggingService</tt>. */ private LoggingService getLoggingService() { if (!loggingServiceSet) { loggingServiceSet = true; loggingService = FocusBundleActivator.getLoggingService(); } ======= return participants.size(); } >>>>>>> return participants.size(); }
<<<<<<< ======= if (logger.isDebugEnabled()) { logger.debug( Thread.currentThread() + " - have alloc response? " + (response != null)); } >>>>>>> <<<<<<< XMPPError error = response.getError(); if (XMPPError.Condition .bad_request.equals(error.getCondition())) ======= if (response == null) >>>>>>> if (response == null) <<<<<<< if (allocChannelsErrorCode != -1) throw new OperationFailedException( allocChannelsErrorMsg, allocChannelsErrorCode, response == null ? null : new Exception(response.toXML().toString())); ======= if (allocChannelsErrorCode != -1) { throw new OperationFailedException( allocChannelsErrorMsg, allocChannelsErrorCode); } } >>>>>>> if (allocChannelsErrorCode != -1) { throw new OperationFailedException( allocChannelsErrorMsg, allocChannelsErrorCode, response == null ? null : new Exception(response.toXML().toString())); } } <<<<<<< logger.debug(message + "\n" + iq.toXML().toString() .replace(">",">\n")); ======= { logger.debug(message + "\n" + iq.toXML().replace(">", ">\n")); } >>>>>>> { logger.debug(message + "\n" + iq.toXML().toString() .replace(">",">\n")); }
<<<<<<< private void createConference( EntityBareJid room, Map<String, String> properties, Level logLevel) ======= private JitsiMeetConferenceImpl createConference( String room, Map<String, String> properties, Level logLevel) >>>>>>> private JitsiMeetConferenceImpl createConference( EntityBareJid room, Map<String, String> properties, Level logLevel)
<<<<<<< BridgeSelector bridgeSelector = meetConference.getServices().getBridgeSelector(); Jid jvb = bridgeSession.colibriConference.getJitsiVideobridge(); if (jvb == null) ======= String jvb = bridgeSession.colibriConference.getJitsiVideobridge(); if (StringUtils.isNullOrEmpty(jvb)) >>>>>>> Jid jvb = bridgeSession.colibriConference.getJitsiVideobridge(); if (jvb == null)
<<<<<<< private GraphQLSchemaUpdater graphQLSchemaUpdater; ======= private EventService eventService; private DefinitionsService definitionsService; @Reference public void setDefinitionsService(DefinitionsService definitionsService) { this.definitionsService = definitionsService; } @Reference public void setEventService(EventService eventService) { this.eventService = eventService; } >>>>>>> private EventService eventService; private DefinitionsService definitionsService; private GraphQLSchemaUpdater graphQLSchemaUpdater; <<<<<<< @Reference public void setGraphQLSchemaUpdater(GraphQLSchemaUpdater graphQLSchemaUpdater) { this.graphQLSchemaUpdater = graphQLSchemaUpdater; } ======= public DefinitionsService getDefinitionsService() { return definitionsService; } public EventService getEventService() { return eventService; } >>>>>>> @Reference public void setDefinitionsService(DefinitionsService definitionsService) { this.definitionsService = definitionsService; } @Reference public void setEventService(EventService eventService) { this.eventService = eventService; } @Reference public void setGraphQLSchemaUpdater(GraphQLSchemaUpdater graphQLSchemaUpdater) { this.graphQLSchemaUpdater = graphQLSchemaUpdater; }
<<<<<<< import de.schildbach.wallet.Constants; import de.schildbach.wallet.WalletApplication; import hashengineering.darkcoin.wallet.R; import hashengineering.darkcoin.wallet.BuildConfig; ======= >>>>>>>
<<<<<<< import org.schabi.newpipe.util.AndroidTvUtils; ======= >>>>>>> import org.schabi.newpipe.util.AndroidTvUtils; <<<<<<< if(AndroidTvUtils.isTv()){ ======= if (FireTvUtils.isFireTv()) { >>>>>>> if(AndroidTvUtils.isTv()){
<<<<<<< ======= import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.Currency; import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.TreeMap; import java.util.zip.GZIPInputStream; import javax.annotation.Nullable; import org.bitcoinj.core.Coin; import org.bitcoinj.utils.Fiat; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; >>>>>>> import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.Currency; import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.TreeMap; import java.util.zip.GZIPInputStream; import javax.annotation.Nullable; import org.bitcoinj.core.Coin; import org.bitcoinj.utils.Fiat; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
<<<<<<< ======= import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.concurrent.TimeUnit; import org.bitcoinj.core.Transaction; import org.bitcoinj.core.VerificationException; import org.bitcoinj.core.VersionMessage; import org.bitcoinj.core.Wallet; import org.bitcoinj.crypto.MnemonicCode; import org.bitcoinj.store.UnreadableWalletException; import org.bitcoinj.store.WalletProtobufSerializer; import org.bitcoinj.utils.Threading; import org.bitcoinj.wallet.Protos; import org.bitcoinj.wallet.WalletFiles; import org.slf4j.Logger; import org.slf4j.LoggerFactory; >>>>>>>
<<<<<<< import de.schildbach.wallet.util.WalletUtils; import hashengineering.darkcoin.wallet.R; ======= import de.schildbach.wallet_test.R; >>>>>>> import hashengineering.darkcoin.wallet.R; <<<<<<< startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.EXPLORE_BASE_URL + Constants.EXPLORE_BLOCK_PATH + storedBlock.getHeader().getHashAsString()))); ======= startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.EXPLORE_BASE_URL + "block/" + block.getHeader().getHashAsString()))); >>>>>>> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.EXPLORE_BASE_URL + Constants.EXPLORE_BLOCK_PATH + block.getHeader().getHashAsString())));
<<<<<<< import android.widget.Toast; ======= >>>>>>> import android.widget.Toast;
<<<<<<< import de.schildbach.wallet.digitalcoin.R; ======= import de.schildbach.wallet.R; >>>>>>> import de.schildbach.wallet.digitalcoin.R; <<<<<<< && CoinDefinition.coinURIScheme.equals(scheme)) ======= && "bitcoin".equals(scheme)) { >>>>>>> && CoinDefinition.coinURIScheme.equals(scheme)) {
<<<<<<< public final class WalletActivity extends AbstractWalletActivity implements ActivityCompat.OnRequestPermissionsResultCallback, NavigationView.OnNavigationItemSelectedListener { ======= public final class WalletActivity extends AbstractBindServiceActivity implements ActivityCompat.OnRequestPermissionsResultCallback { >>>>>>> public final class WalletActivity extends AbstractBindServiceActivity implements ActivityCompat.OnRequestPermissionsResultCallback, NavigationView.OnNavigationItemSelectedListener {
<<<<<<< import hashengineering.darkcoin.wallet.R; ======= >>>>>>> import de.schildbach.wallet_test.R;
<<<<<<< // this means the video was called though another app if (getIntent().getData() != null) { videoUrl = getIntent().getData().toString(); StreamingService[] serviceList = NewPipe.getServices(); //StreamExtractor videoExtractor = null; for (int i = 0; i < serviceList.length; i++) { if (serviceList[i].getUrlIdHandlerInstance().acceptUrl(videoUrl)) { arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, i); currentStreamingService = i; //videoExtractor = NewPipe.getService(i).getExtractorInstance(); break; } } if(currentStreamingService == -1) { Toast.makeText(this, R.string.url_not_supported_toast, Toast.LENGTH_LONG) .show(); ======= handleIntent(getIntent()); } else { videoUrl = savedInstanceState.getString(VideoItemDetailFragment.VIDEO_URL); currentStreamingService = savedInstanceState.getInt(VideoItemDetailFragment.STREAMING_SERVICE); addFragment(savedInstanceState); } } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); handleIntent(intent); } private void handleIntent(Intent intent) { Bundle arguments = new Bundle(); // this means the video was called though another app if (intent.getData() != null) { videoUrl = intent.getData().toString(); StreamingService[] serviceList = ServiceList.getServices(); //StreamExtractor videoExtractor = null; for (int i = 0; i < serviceList.length; i++) { if (serviceList[i].getUrlIdHandlerInstance().acceptUrl(videoUrl)) { arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, i); currentStreamingService = i; //videoExtractor = ServiceList.getService(i).getExtractorInstance(); break; >>>>>>> handleIntent(getIntent()); } else { videoUrl = savedInstanceState.getString(VideoItemDetailFragment.VIDEO_URL); currentStreamingService = savedInstanceState.getInt(VideoItemDetailFragment.STREAMING_SERVICE); addFragment(savedInstanceState); } } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); handleIntent(intent); } private void handleIntent(Intent intent) { Bundle arguments = new Bundle(); // this means the video was called though another app if (intent.getData() != null) { videoUrl = intent.getData().toString(); StreamingService[] serviceList = NewPipe.getServices(); //StreamExtractor videoExtractor = null; for (int i = 0; i < serviceList.length; i++) { if (serviceList[i].getUrlIdHandlerInstance().acceptUrl(videoUrl)) { arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, i); currentStreamingService = i; //videoExtractor = ServiceList.getService(i).getExtractorInstance(); break;
<<<<<<< import de.schildbach.wallet.digitalcoin.R; ======= >>>>>>>
<<<<<<< import hashengineering.darkcoin.wallet.BuildConfig; import org.bitcoinj.core.CoinDefinition; ======= import org.bitcoinj.core.Context; >>>>>>> import hashengineering.darkcoin.wallet.BuildConfig; import org.bitcoinj.core.CoinDefinition; import org.bitcoinj.core.Context; <<<<<<< private static final String EXPLORE_BASE_URL_PROD = CoinDefinition.BLOCKEXPLORER_BASE_URL_PROD; private static final String EXPLORE_BASE_URL_TEST = CoinDefinition.BLOCKEXPLORER_BASE_URL_TEST; /** Base URL for browsing transactions, blocks or addresses. */ public static final String EXPLORE_BASE_URL = NETWORK_PARAMETERS.getId().equals(NetworkParameters.ID_MAINNET) ? EXPLORE_BASE_URL_PROD : EXPLORE_BASE_URL_TEST; public static final String EXPLORE_ADDRESS_PATH = CoinDefinition.BLOCKEXPLORER_ADDRESS_PATH; public static final String EXPLORE_TRANSACTION_PATH = CoinDefinition.BLOCKEXPLORER_TRANSACTION_PATH; public static final String EXPLORE_BLOCK_PATH = CoinDefinition.BLOCKEXPLORER_BLOCK_PATH; public static final String MIMETYPE_BACKUP_PRIVATE_KEYS = "x-"+CoinDefinition.coinName.toLowerCase()+"/private-keys"; private static final String BITEASY_API_URL_PROD = CoinDefinition.UNSPENT_API_URL;//"https://api.biteasy.com/blockchain/v1/"; private static final String BITEASY_API_URL_TEST = "https://api.biteasy.com/testnet/v1/"; ======= private static final String BITEASY_API_URL_PROD = "https://api.biteasy.com/v2/btc/mainnet/"; private static final String BITEASY_API_URL_TEST = "https://api.biteasy.com/v2/btc/testnet/"; >>>>>>> private static final String EXPLORE_BASE_URL_PROD = CoinDefinition.BLOCKEXPLORER_BASE_URL_PROD; private static final String EXPLORE_BASE_URL_TEST = CoinDefinition.BLOCKEXPLORER_BASE_URL_TEST; /** Base URL for browsing transactions, blocks or addresses. */ public static final String EXPLORE_BASE_URL = NETWORK_PARAMETERS.getId().equals(NetworkParameters.ID_MAINNET) ? EXPLORE_BASE_URL_PROD : EXPLORE_BASE_URL_TEST; public static final String EXPLORE_ADDRESS_PATH = CoinDefinition.BLOCKEXPLORER_ADDRESS_PATH; public static final String EXPLORE_TRANSACTION_PATH = CoinDefinition.BLOCKEXPLORER_TRANSACTION_PATH; public static final String EXPLORE_BLOCK_PATH = CoinDefinition.BLOCKEXPLORER_BLOCK_PATH; public static final String MIMETYPE_BACKUP_PRIVATE_KEYS = "x-"+CoinDefinition.coinName.toLowerCase()+"/private-keys"; private static final String BITEASY_API_URL_PROD = CoinDefinition.UNSPENT_API_URL;//"https://api.biteasy.com/blockchain/v1/"; private static final String BITEASY_API_URL_TEST = "https://api.biteasy.com/testnet/v1/"; <<<<<<< public static final String DONATION_ADDRESS = CoinDefinition.DONATION_ADDRESS; ======= public static final String DONATION_ADDRESS = NETWORK_PARAMETERS.getId().equals(NetworkParameters.ID_MAINNET) ? "1Hf8g3XZnDKdCy6FDQt1DrcWz3GeiYLDRS" : null; >>>>>>> public static final String DONATION_ADDRESS = NETWORK_PARAMETERS.getId().equals(NetworkParameters.ID_MAINNET) ? CoinDefinition.DONATION_ADDRESS : null; <<<<<<< ======= public static final String SOURCE_URL = "https://github.com/bitcoin-wallet/bitcoin-wallet"; public static final String BINARY_URL = "https://github.com/bitcoin-wallet/bitcoin-wallet/releases"; >>>>>>>
<<<<<<< ======= import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Arrays; import javax.annotation.Nullable; import org.bitcoin.protocols.payments.Protos.Payment; import org.bitcoinj.core.Address; import org.bitcoinj.core.AddressFormatException; import org.bitcoinj.core.Coin; import org.bitcoinj.core.InsufficientMoneyException; import org.bitcoinj.core.Sha256Hash; import org.bitcoinj.core.Transaction; import org.bitcoinj.core.TransactionConfidence; import org.bitcoinj.core.TransactionConfidence.ConfidenceType; import org.bitcoinj.core.VerificationException; import org.bitcoinj.core.VersionedChecksummedBytes; import org.bitcoinj.core.Wallet; import org.bitcoinj.core.Wallet.BalanceType; import org.bitcoinj.core.Wallet.CouldNotAdjustDownwards; import org.bitcoinj.core.Wallet.DustySendRequested; import org.bitcoinj.core.Wallet.SendRequest; import org.bitcoinj.protocols.payments.PaymentProtocol; import org.bitcoinj.utils.MonetaryFormat; import org.bitcoinj.wallet.KeyChain.KeyPurpose; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.spongycastle.crypto.params.KeyParameter; >>>>>>> <<<<<<< import android.view.*; ======= import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; >>>>>>> import android.view.*; <<<<<<< import de.schildbach.wallet.*; ======= import android.widget.CursorAdapter; import android.widget.EditText; import android.widget.FilterQueryProvider; import android.widget.FrameLayout; import android.widget.TextView; import de.schildbach.wallet.AddressBookProvider; import de.schildbach.wallet.Configuration; import de.schildbach.wallet.Constants; import de.schildbach.wallet.ExchangeRatesProvider; >>>>>>> import de.schildbach.wallet.*; <<<<<<< import de.schildbach.wallet.ui.*; ======= import de.schildbach.wallet.ui.AbstractBindServiceActivity; import de.schildbach.wallet.ui.AddressAndLabel; import de.schildbach.wallet.ui.CurrencyAmountView; import de.schildbach.wallet.ui.CurrencyCalculatorLink; import de.schildbach.wallet.ui.DialogBuilder; import de.schildbach.wallet.ui.ExchangeRateLoader; >>>>>>> import de.schildbach.wallet.ui.*; <<<<<<< ======= import de.schildbach.wallet.ui.ProgressDialogFragment; import de.schildbach.wallet.ui.ScanActivity; import de.schildbach.wallet.ui.TransactionsAdapter; >>>>>>>
<<<<<<< import de.schildbach.wallet.Constants; import hashengineering.darkcoin.wallet.R; import de.schildbach.wallet.util.MonetarySpannable; ======= >>>>>>> <<<<<<< public class CurrencyTextView extends TextView { private Monetary amount = null; private MonetaryFormat format = null; private boolean alwaysSigned = false; private RelativeSizeSpan prefixRelativeSizeSpan = null; private ScaleXSpan prefixScaleXSpan = null; private ForegroundColorSpan prefixColorSpan = null; private RelativeSizeSpan insignificantRelativeSizeSpan = null; public CurrencyTextView(final Context context) { super(context); } public CurrencyTextView(final Context context, final AttributeSet attrs) { super(context, attrs); } public void setAmount(final Monetary amount) { this.amount = amount; updateView(); } public void setFormat(final MonetaryFormat format) { this.format = format.codeSeparator(Constants.CHAR_HAIR_SPACE); updateView(); } public void setAlwaysSigned(final boolean alwaysSigned) { this.alwaysSigned = alwaysSigned; updateView(); } public void setStrikeThru(final boolean strikeThru) { if (strikeThru) setPaintFlags(getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); else setPaintFlags(getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } public void setInsignificantRelativeSize(final float insignificantRelativeSize) { if (insignificantRelativeSize != 1) { this.prefixRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize); this.insignificantRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize); } else { this.prefixRelativeSizeSpan = null; this.insignificantRelativeSizeSpan = null; } } public void setPrefixColor(final int prefixColor) { this.prefixColorSpan = new ForegroundColorSpan(prefixColor); updateView(); } public void setPrefixScaleX(final float prefixScaleX) { this.prefixScaleXSpan = new ScaleXSpan(prefixScaleX); updateView(); } @Override protected void onFinishInflate() { super.onFinishInflate(); setPrefixColor(ContextCompat.getColor(getContext(), R.color.white)); setPrefixScaleX(1); setInsignificantRelativeSize(0.85f); setSingleLine(); } private void updateView() { final MonetarySpannable text; if (amount != null) text = new MonetarySpannable(format, alwaysSigned, amount).applyMarkup(new Object[] { prefixRelativeSizeSpan, prefixScaleXSpan, prefixColorSpan }, new Object[] { insignificantRelativeSizeSpan }); else text = null; setTextFormat(text); } protected void setTextFormat(CharSequence text) { setText(text); } ======= public final class CurrencyTextView extends TextView { private Monetary amount = null; private MonetaryFormat format = null; private boolean alwaysSigned = false; private RelativeSizeSpan prefixRelativeSizeSpan = null; private ScaleXSpan prefixScaleXSpan = null; private ForegroundColorSpan prefixColorSpan = null; private RelativeSizeSpan insignificantRelativeSizeSpan = null; public CurrencyTextView(final Context context) { super(context); } public CurrencyTextView(final Context context, final AttributeSet attrs) { super(context, attrs); } public void setAmount(final Monetary amount) { this.amount = amount; updateView(); } public void setFormat(final MonetaryFormat format) { this.format = format.codeSeparator(Constants.CHAR_HAIR_SPACE); updateView(); } public void setAlwaysSigned(final boolean alwaysSigned) { this.alwaysSigned = alwaysSigned; updateView(); } public void setStrikeThru(final boolean strikeThru) { if (strikeThru) setPaintFlags(getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); else setPaintFlags(getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } public void setInsignificantRelativeSize(final float insignificantRelativeSize) { if (insignificantRelativeSize != 1) { this.prefixRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize); this.insignificantRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize); } else { this.prefixRelativeSizeSpan = null; this.insignificantRelativeSizeSpan = null; } } public void setPrefixColor(final int prefixColor) { this.prefixColorSpan = new ForegroundColorSpan(prefixColor); updateView(); } public void setPrefixScaleX(final float prefixScaleX) { this.prefixScaleXSpan = new ScaleXSpan(prefixScaleX); updateView(); } @Override protected void onFinishInflate() { super.onFinishInflate(); setPrefixColor(getResources().getColor(R.color.fg_less_significant)); setPrefixScaleX(1); setInsignificantRelativeSize(0.85f); setSingleLine(); } private void updateView() { final MonetarySpannable text; if (amount != null) text = new MonetarySpannable(format, alwaysSigned, amount).applyMarkup( new Object[] { prefixRelativeSizeSpan, prefixScaleXSpan, prefixColorSpan }, new Object[] { insignificantRelativeSizeSpan }); else text = null; setText(text); } >>>>>>> public class CurrencyTextView extends TextView { private Monetary amount = null; private MonetaryFormat format = null; private boolean alwaysSigned = false; private RelativeSizeSpan prefixRelativeSizeSpan = null; private ScaleXSpan prefixScaleXSpan = null; private ForegroundColorSpan prefixColorSpan = null; private RelativeSizeSpan insignificantRelativeSizeSpan = null; public CurrencyTextView(final Context context) { super(context); } public CurrencyTextView(final Context context, final AttributeSet attrs) { super(context, attrs); } public void setAmount(final Monetary amount) { this.amount = amount; updateView(); } public void setFormat(final MonetaryFormat format) { this.format = format.codeSeparator(Constants.CHAR_HAIR_SPACE); updateView(); } public void setAlwaysSigned(final boolean alwaysSigned) { this.alwaysSigned = alwaysSigned; updateView(); } public void setStrikeThru(final boolean strikeThru) { if (strikeThru) setPaintFlags(getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); else setPaintFlags(getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } public void setInsignificantRelativeSize(final float insignificantRelativeSize) { if (insignificantRelativeSize != 1) { this.prefixRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize); this.insignificantRelativeSizeSpan = new RelativeSizeSpan(insignificantRelativeSize); } else { this.prefixRelativeSizeSpan = null; this.insignificantRelativeSizeSpan = null; } } public void setPrefixColor(final int prefixColor) { this.prefixColorSpan = new ForegroundColorSpan(prefixColor); updateView(); } public void setPrefixScaleX(final float prefixScaleX) { this.prefixScaleXSpan = new ScaleXSpan(prefixScaleX); updateView(); } @Override protected void onFinishInflate() { super.onFinishInflate(); setPrefixColor(getResources().getColor(R.color.fg_less_significant)); setPrefixScaleX(1); setInsignificantRelativeSize(0.85f); setSingleLine(); } private void updateView() { final MonetarySpannable text; if (amount != null) text = new MonetarySpannable(format, alwaysSigned, amount).applyMarkup( new Object[] { prefixRelativeSizeSpan, prefixScaleXSpan, prefixColorSpan }, new Object[] { insignificantRelativeSizeSpan }); else text = null; setText(text); }