1. Java / Говнокод #15482

    +70

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    public boolean fastItemEquals(ItemStack st, ItemStack nd) {
            if(st.hashCode() != nd.hashCode()) return false;
            if(st.getType() != nd.getType()) return false;
            if(!st.getItemMeta().getDisplayName().equals(nd.getItemMeta().getDisplayName())) return false;
            if(st.getEnchantments().size() != nd.getEnchantments().size()) return false;
            //return st.isSimilar(nd);
            return true;
        }
        
        /* оригинал
        @Override
        public boolean isSimilar(ItemStack stack) {
            if (stack == null) {
                return false;
            }
            if (stack == this) {
                return true;
            }
            if (!(stack instanceof CraftItemStack)) {
                return stack.getClass() == ItemStack.class && stack.isSimilar(this);
            }
    
            CraftItemStack that = (CraftItemStack) stack;
            if (handle == that.handle) {
                return true;
            }
            if (handle == null || that.handle == null) {
                return false;
            }
            if (!(that.getTypeId() == getTypeId() && getDurability() == that.getDurability())) {
                return false;
            }
            return hasItemMeta() ? that.hasItemMeta() && handle.tag.equals(that.handle.tag) : !that.hasItemMeta();
        }
        */

    DiaLight, 15 Марта 2014

    Комментарии (0)
  2. Java / Говнокод #15460

    +84

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    private final public static volatile transient synchronized protected InterceptorSingletonVisitor interceptorSingletonVisitor(AbstractDecoratorStrategyProxyObserverInterceptorBuilder abstractDecoratorStrategyProxyObserverInterceptorBuilder, AbstractVisitorAdvisorFacadeListener abstractVisitorAdvisorFacadeListener, VisitorFactoryFactoryBuilder visitorFactoryFactoryBuilder, VisitorProxyFacadeFactoryFactorySingletonAdvisorDecorator visitorProxyFacadeFactoryFactorySingletonAdvisorDecorator, AbstractAdvisorBuilderDecoratorInterceptor abstractAdvisorBuilderDecoratorInterceptor) {
    AbstractProxyAdvisor abstractProxyAdvisor = abstractFactoryFactoryDecorator.getListenerInterceptorFactoryFactory().getAbstractProxyAdvisor();
    AbstractVisitorAdvisorListenerStrategySingletonIteratorAdapterFactory abstractVisitorAdvisorListenerStrategySingletonIteratorAdapterFactory = new AbstractVisitorAdvisorListenerStrategySingletonIteratorAdapterFactory();
    abstractBeanAdvisorSingletonInterceptor.setAbstractFactoryFactoryAdvisorFacadeStrategy(this.abstractFactoryFactoryAdvisorFacadeStrategy);
    AbstractAdvisorProxyStrategyIteratorVisitorObserver abstractAdvisorProxyStrategyIteratorVisitorObserver = new AbstractAdvisorProxyStrategyIteratorVisitorObserver();
    
    if(abstractSingletonFacadeFactoryObserver.isInterceptorListenerFacade()) {
    iteratorProxyListenerFacadeBean.setAbstractStrategyBean(this.abstractStrategyBean);
    AbstractFactoryDecoratorBeanFacadeAdapterProxyAdvisorVisitor abstractFactoryDecoratorBeanFacadeAdapterProxyAdvisorVisitor = abstractBeanInterceptorIteratorListenerFactoryFactoryStrategyProxyObserver.getAbstractObserverFacadeListenerSingletonProxyAdvisorStrategyVisitor().getAbstractFactoryDecoratorBeanFacadeAdapterProxyAdvisorVisitor();
    abstractProxyBuilderVisitorSingleton.setIteratorAdvisorProxySingletonAdapter(this.iteratorAdvisorProxySingletonAdapter);
    
    if(abstractDecoratorAdapterVisitorProxyObserverIteratorBuilderFactory.isDecoratorFactoryFactoryFacade()) {
    visitorIteratorObserverProxyAdvisor.setAbstractObserverSingletonProxyAdvisorBuilderDecorator(this.abstractObserverSingletonProxyAdvisorBuilderDecorator);
    singletonFacadeAdapterListenerFactory.setAbstractIteratorInterceptorSingletonListenerAdvisorDecoratorBuilderFactoryFactory(this.abstractIteratorInterceptorSingletonListenerAdvisorDecoratorBuilderFactoryFactory);
    
    while(abstractFactoryAdapterSingletonFactoryFactory.isAbstractStrategyFactory()) {
    abstractAdapterBeanStrategySingletonAdvisorBuilderListenerFactory.setAbstractStrategyFactoryFactoryFacadeBuilderFactoryIteratorProxyObserver(this.abstractStrategyFactoryFactoryFacadeBuilderFactoryIteratorProxyObserver);
    abstractObserverAdapterFactoryFacadeDecoratorBuilderInterceptorFactoryFactory.setAdvisorIteratorFactoryProxyDecorator(this.advisorIteratorFactoryProxyDecorator);
    
    while(abstractFacadeListenerStrategyIteratorAdvisorSingletonProxyObserver.isVisitorDecoratorInterceptorIteratorAdapter()) {
    abstractProxyAdapterInterceptorObserverFactoryFactoryIterator.setSingletonFactoryFactoryProxyIteratorStrategy(this.singletonFactoryFactoryProxyIteratorStrategy);
    singletonInterceptorDecorator.setAbstractFactoryFactoryListenerBuilderAdvisorDecoratorFacade(this.abstractFactoryFactoryListenerBuilderAdvisorDecoratorFacade);
    visitorFactoryFactoryAdapterIteratorInterceptor.setAbstractIteratorVisitor(this.abstractIteratorVisitor);
    }
    }
    } else {
    abstractListenerInterceptorStrategyVisitorBeanFactorySingletonIterator.setAbstractProxyStrategy(this.abstractProxyStrategy);
    abstractProxyInterceptorSingletonFactoryFactory.setAbstractSingletonIterator(this.abstractSingletonIterator);
    }
    } else {
    singletonListenerFactoryFactoryIteratorProxy.setAbstractObserverProxyIteratorVisitor(this.abstractObserverProxyIteratorVisitor);
    }
    
    return new InterceptorSingletonVisitor();
    }

    laMer007, 13 Марта 2014

    Комментарии (55)
  3. Java / Говнокод #15457

    +72

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (button.getSelection()) {
        combo.getCombo().setVisible(false);
        text.setVisible(true);
    } else {
        combo.getCombo().setVisible(true);
        text.setVisible(false);
    }

    evg_ever, 13 Марта 2014

    Комментарии (11)
  4. Java / Говнокод #15375

    +84

    1. 1
    // TODO: Add comment here to explain what we do

    нашёл на прасторах праектуса %))

    Pepper-X, 06 Марта 2014

    Комментарии (25)
  5. Java / Говнокод #15372

    +77

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    List<DataContainer> dataContainers = w2pService.startProcess(type, id, locale.replaceAll("-", "_"), clientToken);
    			
    //prevent memory leak
    if(dataContainers != null){
        dataContainers.clear();
        dataContainers = null;
    }

    Насоздавал - предоврати за собой.

    pingw33n, 06 Марта 2014

    Комментарии (5)
  6. Java / Говнокод #15300

    +75

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    private boolean isShowPosition(List<Integer> lists, int p) {
            for (int l : lists) {
                if (p == l)
                    return true;
            }
            return false;
        }

    Вьетнамское творчество

    AAverin, 04 Марта 2014

    Комментарии (38)
  7. Java / Говнокод #15252

    +67

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public class LoaderForMongoCompanies extends AbstractJdbcLoader {
    
        @Override
        protected String getTableSuffix() {
            return "mongo";
        }
    
    }

    нужно больше классов

    roman-kashitsyn, 28 Февраля 2014

    Комментарии (38)
  8. Java / Говнокод #15009

    +69

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    final double base = 10.0;
    final int minCode = (int)Math.pow(base, CODE_LENGTH - 1) - 1;
    final int maxCode = (int)Math.pow(base, CODE_LENGTH) - 1;
    
    while (true)
    {
        final int code = codeGenerator.nextInt();
        if ((code > minCode) && (code <= maxCode))
        {
            return String.valueOf(code);
        }
    }

    Геренация случайного пина с определенным интервалом.

    rvller, 26 Февраля 2014

    Комментарии (6)
  9. Java / Говнокод #14591

    +70

    1. 1
    2. 2
    .
    																		buffer.put(Transaction.getTransaction((JSONObject)transactionsData.get(j)).getBytes());

    Вложенность, например. Но это нужно видеть целиком.
    https://bitbucket.org/JeanLucPicard/nxt-public/src/

    rat4, 15 Февраля 2014

    Комментарии (14)
  10. Java / Говнокод #14583

    +73

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    final double[][] matrix = new double[companies.size() + 1][(sampleSizeTo - sampleSizeFrom) / sampleSizeStep + 2];
    for (int i = 0; i < matrix.length; i++) {
        for (int j = 0; j < matrix[0].length; j++) {
            if (i == 0 && j == 0) {
                continue;
            }
            if (i == 0) {
                matrix[i][j] = sampleSizeFrom + (j - 1) * sampleSizeStep;
                continue;
            }
            if (j == 0) {
                matrix[i][j] = companies.get(i-1);
                continue;
            }
        }
    }

    Название функции getSmartDistibution (именно так) какбэ намекает, что дальше будет весело

    roman-kashitsyn, 14 Февраля 2014

    Комментарии (5)