text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <TITLE>Adobe Software Technology Lab: number_unit.hpp File Reference</TITLE>
    <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
    <LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/>
    <LINK REL="alternate" TITLE="stlab.adobe.com RSS" HREF="http://sourceforge.net/export/rss2_projnews.php?group_id=132417&rss_fulltext=1" TYPE="application/rss+xml"/>

Documentation

        Overview

        Building ASL

        Documentation

        Library Wiki Docs

        Indices

        Browse Perforce

More Info

        Release Notes

        Wiki

        Site Search

        License

        Success Stories

        Contributors

Media

        Download

        Perforce Depots

Support

        ASL SourceForge Home

        Mailing Lists

        Discussion Forums

        Report Bugs

        Suggest Features

        Contribute to ASL

RSS

        Short-text news

        Full-text news

        File releases

Other Adobe Projects

        Open @ Adobe

        Adobe Open Source

        Adobe Labs

        Adobe Media Gallery

        C++ Benchmarks

Other Resources

        Boost

        RIAForge

        SGI STL

Classes |
Namespaces |
Functions

number_unit.hpp File Reference

#include <adobe/algorithm/clamp.hpp>

#include <adobe/name_fwd.hpp>

#include <adobe/dictionary_fwd.hpp>

#include <string>

Go to the source code of this file.

Classes

struct  	unit_t

Namespaces

namespace  	adobe

Functions

double 	to_base_value (double scaled_value, const unit_t &unit)

double 	to_pinned_base_value (double scaled_value, const unit_t &unit, double min, double max)

double 	to_scaled_value (double base_value, const unit_t &unit)

unit_t 	to_unit (const dictionary_t &dict, const unit_t &default_unit=unit_t())

Company |

Online Privacy Policy |

Terms of Use |

Contact Us |

Accessibility |

Report Piracy |

Permissions & Trademarks |

Product License Agreements |

Send Feedback

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google


text:
package org.eknet.sitebag

import spray.http._
import spray.http.Uri.Path
import porter.util.Hash
import scala.util.Try

object utils {

  def parseContentType(ct: String): Option[ContentType] = {
    val islash = ct.indexOf('/')
    val (m1, s1) = if (islash > 0) ct.substring(0, islash).trim -> ct.substring(islash+1).trim
    else ct -> ct
    val isemi = s1.indexOf(';')
    val (m, s, c) = if (isemi > 0) (m1.trim, s1.substring(0, isemi).trim, s1.substring(isemi + 1).trim)
    else (m1.trim, s1.trim, "")

    val cs = if (c.nonEmpty) Try(c.substring(8).trim).toOption.flatMap(HttpCharset.custom(_)) else None
    val mt = MediaTypes.getForKey(m -> s)
    mt.map(m => ContentType(m, cs))
  }

  def contentTypeByExtension(uri: Uri): Option[ContentType] = {
    val fname = uri.filename
    val i = fname.indexOf('.')
    if (i > 0) MediaTypes.forExtension(fname.substring(i+1)).map(ContentType.apply)
    else None
  }

  def getContentTypeWithFallback(str: Option[String], uri: Uri) = {
    str.flatMap(parseContentType)
      .orElse(contentTypeByExtension(uri))
      .getOrElse(ContentTypes.`application/octet-stream`)
  }

  implicit class ByteAdds(b: Byte) {
    def isHexChar = (b>='0' && b<='9') || (b>='A' && b<='F') || (b>='a' && b<='f')
    def percentageEncoded = "%%%02X" format (b & 0xFF)
    def percentageEncode(valid: Set[Byte]): String =
      if (valid contains b) b.asInstanceOf[Char].toString else b.percentageEncoded
  }

  implicit class StringOps(s: String) {
    def toOption = if (s.trim.nonEmpty) Some(s.trim) else None

    def takeDots(max: Int) = {
      s.length match {
        case l if l <= max => s
        case l             => s.take(max-3) + "..."
      }
    }

    def percentageEncoded(validBytes: Set[Byte] = validUriChars): String = {
      def hexSuffix(a: Array[Byte]) = a.length == 3 && a(1).isHexChar && a(2).isHexChar
      if (s.isEmpty) s
      else {
        val bytes = s.getBytes
        val pass1 = bytes.sliding(3).map {
          win =>
            win(0) match {
              case '%' => if (hexSuffix(win)) '%' else '%'.toByte.percentageEncoded
              case c => c.percentageEncode(validBytes)
            }
        }.mkString
        //the last chars
        if (bytes.length == 2) pass1 + bytes.takeRight(1)(0).percentageEncode(validBytes)
          else if (bytes.length == 1) pass1
          else pass1 + bytes.takeRight(2).map(_.percentageEncode(validBytes)).reduce(_ + _)
      }
    }
  }

  implicit class UriAdds(uri: Uri) {
    def filename: String = {
      uri.path match {
        case Path.Empty => Hash.md5String(uri.toString())
        case p => p.reverse.head.toString
      }
    }
  }

  private val validUriChars =
    ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
      "abcdefghijklmnopqrstuvwxyz" +
      "0123456789" +
      "-._~:/?#[]@!$&'()*+,;=").toSet.map((c: Char) => c.toByte)

  implicit class UriStatics(val uri: Uri.type ) extends AnyVal {

    /**
     * Converts a string into an uri by replacing invalid
     * chars by the "percentage notation".
     *
     * @param uriString
     * @return
     */
    def sanitized(uriString: String): Uri = {
      if (uriString.isEmpty) Uri.Empty
      else {
        val nextUri = uriString.percentageEncoded(validUriChars)
        nextUri.indexOf('?') match {
          case x if x > 0 =>
            val qp = nextUri.substring(x+1).split('&').toList.map { s=>
              s.split("=", 2).toList match {
                case a::b::Nil => a +"="+ b.flatMap(c => c.toByte.percentageEncode(validUriChars - '='.toByte))
                case a::tail => a +"="
              }
            }

            nextUri.substring(0, x) + "?" + qp.mkString("&")
          case _ => nextUri
        }
      }
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef QT3D_RENDER_QUICK_QUICK3DSTATESET_H
#define QT3D_RENDER_QUICK_QUICK3DSTATESET_H

#include <Qt3DQuickRenderer/qt3dquickrenderer_global.h>
#include <Qt3DRenderer/qstateset.h>
#include <QQmlListProperty>

QT_BEGIN_NAMESPACE

namespace Qt3D {

namespace Render {

namespace Quick {

class QT3DQUICKRENDERERSHARED_EXPORT Quick3DStateSet : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QQmlListProperty<Qt3D::QRenderState> renderStates READ renderStateList CONSTANT)
public:
    explicit Quick3DStateSet(QObject *parent = 0);
    ~Quick3DStateSet();

    QQmlListProperty<Qt3D::QRenderState> renderStateList();
    inline QStateSet *parentStateSet() const { return qobject_cast<QStateSet *>(parent()); }

private:
    static void appendRenderState(QQmlListProperty<Qt3D::QRenderState> *list, QRenderState *state);
    static QRenderState *renderStateAt(QQmlListProperty<Qt3D::QRenderState> *list, int index);
    static int renderStateCount(QQmlListProperty<Qt3D::QRenderState> *list);
    static void clearRenderStates(QQmlListProperty<Qt3D::QRenderState> *list);
};

} // Quick

} // Render

} // Qt3D

QT_END_NAMESPACE

#endif // QT3D_RENDER_QUICK_QUICK3DSTATESET_H


text:
package com.limemobile.app.blog.activity;

import java.util.ArrayList;

import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import com.limemobile.app.blog.R;
import com.limemobile.app.blog.activity.adapter.MutualListAdapter;
import com.limemobile.app.blog.activity.preference.Setting;
import com.limemobile.app.blog.activity.theme.Theme;
import com.limemobile.app.blog.constant.ITransKey;
import com.limemobile.app.blog.weibo.tencent.api.ILoadListener;
import com.limemobile.app.blog.weibo.tencent.api.IResultListener;
import com.limemobile.app.blog.weibo.tencent.api.friends.DelTask;
import com.limemobile.app.blog.weibo.tencent.api.friends.MutualListTask;
import com.limemobile.app.blog.weibo.tencent.entity.Entity;
import com.limemobile.app.blog.weibo.tencent.entity.TObject;
import com.limemobile.app.blog.weibo.tencent.entity.friends.Mutual;
import com.limemobile.app.utils.NetUtils;
import com.limemobile.app.utils.ToastUtils;
import com.limemobile.app.utils.UserTask;
import com.markupartist.android.widget.PullToRefreshListView;
import com.markupartist.android.widget.PullToRefreshListView.OnRefreshListener;

import edu.mit.mobile.android.imagecache.ImageLoaderAdapter;

public class MutualListActivity extends ThemeActivity implements OnClickListener,
        OnItemClickListener {
    private static final int REQNUM = 30;

    private ViewGroup mainContainer;
    private View back;
    private View home;
    private TextView title;
    private ViewGroup titlebar;
    private ListView listView;
    private ViewGroup listFooter;
    private View listFooterContainer;
    private ProgressBar listFooterProgressBar;
    private TextView listFooterText;
    private ArrayList<Mutual.Info> array;
    private Mutual friend;
    private MutualListAdapter adapter;
    private String openid;
    private int pageIndex = 1;
    private UserTask<Object, Void, Boolean> refreshTask;
    private UserTask<Object, Void, Boolean> delTask;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = getIntent();
        if (intent != null)
            openid = intent.getStringExtra(ITransKey.KEY);
        if (TextUtils.isEmpty(openid)) {
            finish();
            return;
        }
        setContentView(R.layout.activity_users_list);

        array = new ArrayList<Mutual.Info>();
        adapter = new MutualListAdapter(this, array, this);
        initViews();
    }

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        titlebar.post(new Runnable() {

            @Override
            public void run() {
                ((PullToRefreshListView) listView).clickRefresh();
            }

        });
        super.onPostCreate(savedInstanceState);
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        if (isFinishing()) {
            final UserTask<Object, Void, Boolean> task = refreshTask;
            if (task != null && task.getStatus() != UserTask.Status.FINISHED) {
                task.cancel(true);
                refreshTask = null;
            }
            final UserTask<Object, Void, Boolean> task2 = delTask;
            if (task2 != null && task2.getStatus() != UserTask.Status.FINISHED) {
                task2.cancel(true);
                delTask = null;
            }
        }
        super.onSaveInstanceState(outState);
    }

    @Override
    protected void onResume() {
    	listView.setFastScrollEnabled(Setting.fastScrollEnabled);
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.back:
                finish();
                break;
            case R.id.home:
                Intent intent = new Intent(this, MainActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                intent.putExtra(ITransKey.KEY, 0);
                startActivity(intent);
                break;
            case R.id.main_list_foot:
                refresh(true);
                break;
            case R.id.item_action:
            	if (NetUtils.getType(this) == NetUtils.NO_NET) {
            		ToastUtils.show(this, R.string.msg_nonetwork, Toast.LENGTH_SHORT);
            		return;
            	}
                if (v.getTag() != null && v.getTag() instanceof Mutual.Info) {
                    final Mutual.Info info = (Mutual.Info) v.getTag();
                    final UserTask<Object, Void, Boolean> task = delTask;
                    if (task != null && task.getStatus() != UserTask.Status.FINISHED) {
                        return;
                    }
                    delTask = new DelTask(mainContainer, loadListener, new IResultListener() {

                        @Override
                        public void onSuccess(Entity<TObject> data) {
                            mainContainer.post(new Runnable() {

                                @Override
                                public void run() {
                                    array.remove(info);
                                    if (adapter != null)
                                        adapter.notifyDataSetChanged();
                                    ToastUtils.show(mainContainer.getContext(),
                                            R.string.del_attention_ok, Toast.LENGTH_SHORT);
                                }

                            });
                        }

                        @Override
                        public void onFail(Entity<TObject> data) {
                            mainContainer.post(new Runnable() {

                                @Override
                                public void run() {
                                    ToastUtils.show(mainContainer.getContext(),
                                            R.string.del_attention_failed, Toast.LENGTH_SHORT);
                                }

                            });
                        }

                    }).execute(info.name, "");
                }
                break;
        }
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        if (view.getTag() != null && view.getTag() instanceof MutualListAdapter.ViewHolder) {
            final MutualListAdapter.ViewHolder holder = (MutualListAdapter.ViewHolder) view.getTag();
            final Mutual.Info info = (Mutual.Info) holder.object;
            Intent intent = new Intent(this, UserInfoActivity.class);
            intent.putExtra(ITransKey.KEY, info.name);
            intent.putExtra(ITransKey.KEY1, info.openid);
            startActivity(intent);
        }
    }

    @Override
    public void initViews() {
        mainContainer = (ViewGroup) findViewById(R.id.main_container);
        home = findViewById(R.id.home);
        home.setOnClickListener(this);
        back = findViewById(R.id.back);
        back.setOnClickListener(this);
        titlebar = (ViewGroup) findViewById(R.id.main_titlebar);
        title = (TextView) findViewById(R.id.title);
        title.setText(R.string.user_info_mutual);

        listView = (ListView) findViewById(R.id.listview);
        listFooter = (ViewGroup) LayoutInflater.from(this).inflate(R.layout.list_footer, null);
        listFooterProgressBar = (ProgressBar) listFooter.findViewById(R.id.loading_progress);
        listFooterText = (TextView) listFooter.findViewById(R.id.progress_loading_text);
        listView.addFooterView(listFooter);
        listFooterContainer = (View) listFooter.findViewById(R.id.main_list_foot);
        listFooterContainer.setOnClickListener(this);
        Drawable drawable = getResources().getDrawable(R.drawable.portrait_small);
        int iconWidth = drawable.getIntrinsicWidth();
        int iconHeight = drawable.getIntrinsicHeight();
        listView.setAdapter(new ImageLoaderAdapter(this, adapter, MyApplication.imageCache,
                new int[] {
                    R.id.item_image
                }, iconWidth, iconHeight, ImageLoaderAdapter.UNIT_PX));

        // Set a listener to be invoked when the list should be refreshed.
        ((PullToRefreshListView) listView).setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh() {
                // Do work to refresh the list here.
                refresh(false);
            }
        });
        listView.setOnItemClickListener(this);
    }

    @Override
    public void themeChanged() {
        Resources res = Theme.getInstance().getContext(this).getResources();
        back.setBackgroundDrawable(res.getDrawable(R.drawable.title_back));
        home.setBackgroundDrawable(res.getDrawable(R.drawable.title_home));
        titlebar.setBackgroundDrawable(res.getDrawable(R.drawable.title_bar_bg));
    }

    public void refresh(boolean invokedByListFooter) {
    	if (NetUtils.getType(this) == NetUtils.NO_NET) {
    		ToastUtils.show(this, R.string.msg_nonetwork, Toast.LENGTH_SHORT);
    		return;
    	}
        final UserTask<Object, Void, Boolean> task = refreshTask;
        if (task != null && task.getStatus() != UserTask.Status.FINISHED) {
            return;
        }
        refreshTask = new MutualListTask(invokedByListFooter ? listFooterLoadListener : loadListener,
                resultListener).execute("", openid, REQNUM * (pageIndex++ - 1), REQNUM, 0);
    }

    private IResultListener resultListener = new IResultListener() {

        @Override
        public void onSuccess(final Entity<TObject> data) {
            titlebar.post(new Runnable() {

                @Override
                public void run() {
                    // Call onRefreshComplete when the list has been refreshed.
                    if (listView != null)
                        ((PullToRefreshListView) listView).onRefreshComplete();
                    if (data != null && data.data != null && data.data instanceof Mutual) {
                        friend = (Mutual) data.data;
                        if (friend.info != null)
                            for (Mutual.Info info : friend.info)
                                array.add(info);
                    }
                    if (adapter != null)
                        adapter.notifyDataSetChanged();
                }

            });
        }

        @Override
        public void onFail(Entity<TObject> data) {
            titlebar.post(new Runnable() {

                @Override
                public void run() {
                    // Call onRefreshComplete when the list has been refreshed.
                    if (listView != null)
                        ((PullToRefreshListView) listView).onRefreshComplete();
                    ToastUtils.show(titlebar.getContext(), R.string.communicating_failed,
                            Toast.LENGTH_SHORT);
                }

            });
        }

    };

    private ILoadListener listFooterLoadListener = new ILoadListener() {

        @Override
        public void onStart(TextView v) {
            listFooterProgressBar.setVisibility(View.VISIBLE);
            listFooterText.setText(R.string.progress_loading_text);
        }

        @Override
        public void onEnd() {
            listFooterProgressBar.setVisibility(View.GONE);
            listFooterText.setText(R.string.more);
            if (friend != null && friend.hasnext == 1)
                listFooterContainer.setVisibility(View.GONE);
            else
                listFooterContainer.setVisibility(View.VISIBLE);
        }

    };

    private ILoadListener loadListener = new ILoadListener() {

        @Override
        public void onStart(TextView v) {
            listFooterContainer.setVisibility(View.GONE);
            if (v != null)
                v.setText(R.string.progress_loading_text);
        }

        @Override
        public void onEnd() {
            listFooterContainer.setVisibility(View.VISIBLE);
            if (friend != null && friend.hasnext == 1)
                listFooterContainer.setVisibility(View.GONE);
            else
                listFooterContainer.setVisibility(View.VISIBLE);
        }

    };
}


text:
var CountEditionBase = require('./count_edition_base');
var BaseView = require('../../lib/base_view');
var app = require('../../application');

var colorSet = require('../../helper/color_set');

/*
 * Manage the count updating
 */
var CountUpdateView = CountEditionBase.extend({
  id: 'count-editor-screen',
  template: require('./templates/count_update'),
  templateUrl: require('./templates/url'),

  events: {
    'click #submit-editor'  : 'lauchCountUpdate',
    'click #input-public'   : 'changePublicStatus'
  },

  initialize: function (params) {

    this.count = params.count;

    if (this.count === null || this.count === undefined) {
      console.error("Error: retrieve count update");
    }

    BaseView.prototype.initialize.call(this);
  },

  /*
   * Add a listener in the changes on the input of name. That permit a dynamique
   * warning.
   */
  afterRender: function () {
    this.$('#input-name')[0].addEventListener('change', (function (_this) {
      return function (event) {
        var res = _this.checkCountName(event);
        if (res !== null) {
          _this.count.set('name', res);
        }
      };
    }(this)));

    if (this.count !== null && this.count.get('isPublic')) {
      this.setPublic();
    }
  },

  /*
   * Set the variable <this.isPublic> which will set the credential to the futur
   * access from the public area.
   */
  changePublicStatus: function () {
    if (!this.count.get('isPublic')) {
      this.setPublic();
    } else {
      this.setPrivate();
    }
  },

  setPublic: function () {
    this.count.set('isPublic', true);
    this.$('#input-public').text('Make this count private');
    this.$('#public-section').append(this.templateUrl({
      url: this.createPublicUrl()
    }));
  },

  setPrivate: function () {
    this.count.set('isPublic', false);
    this.$('#input-public').text('Make this count public');
    this.$('#public-section-body').remove();
  },

  createPublicUrl: function () {

    if (window.domain === false || window.domain === null ||
        window.domain === undefined) {
      return (window.location.origin + '/public/count/' + this.count.id);
    }

    return (window.domain + '/public/count/' + this.count.id);
  },

  getRenderData: function () {
    if (this.count !== null) {
      return ({model: this.count.toJSON()});
    }
    return ({model: null});
  },

  /*
   * Lauche an update server side
   */
  lauchCountUpdate: function () {
    this.count.set('description', this.$('#input-description').val());

    this.count.save(this.count.attributes, {
      error: function (xhr) {
        console.error('Count update fail: ', xhr);
      },
      success: function (data) {
        app.router.navigate('/count/' + data.get('name'), {trigger: true});
      }
    });
  },
});

module.exports = CountUpdateView;


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 ci et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "mozilla/AvailableMemoryTracker.h"

#include "prinrval.h"
#include "pratom.h"
#include "prenv.h"

#include "nsIMemoryReporter.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIRunnable.h"
#include "nsISupports.h"
#include "nsPrintfCString.h"
#include "nsThread.h"

#include "mozilla/Preferences.h"
#include "mozilla/Services.h"

#if defined(XP_WIN)
#   include "nsWindowsDllInterceptor.h"
#   include <windows.h>
#endif

#if defined(MOZ_MEMORY)
#   include "mozmemory.h"
#endif  // MOZ_MEMORY

using namespace mozilla;

namespace {

#if defined(XP_WIN)

// We don't want our diagnostic functions to call malloc, because that could
// call VirtualAlloc, and we'd end up back in here!  So here are a few simple
// debugging macros (modeled on jemalloc's), which hopefully won't allocate.

// #define LOGGING_ENABLED

#ifdef LOGGING_ENABLED

#define LOG(msg)       \
  do {                 \
    safe_write(msg);   \
    safe_write("\n");  \
  } while(0)

#define LOG2(m1, m2)   \
  do {                 \
    safe_write(m1);    \
    safe_write(m2);    \
    safe_write("\n");  \
  } while(0)

#define LOG3(m1, m2, m3) \
  do {                   \
    safe_write(m1);      \
    safe_write(m2);      \
    safe_write(m3);      \
    safe_write("\n");    \
  } while(0)

#define LOG4(m1, m2, m3, m4) \
  do {                       \
    safe_write(m1);          \
    safe_write(m2);          \
    safe_write(m3);          \
    safe_write(m4);          \
    safe_write("\n");        \
  } while(0)

#else

#define LOG(msg)
#define LOG2(m1, m2)
#define LOG3(m1, m2, m3)
#define LOG4(m1, m2, m3, m4)

#endif

void safe_write(const char *a)
{
  // Well, puts isn't exactly "safe", but at least it doesn't call malloc...
  fputs(a, stdout);
}

void safe_write(uint64_t x)
{
  // 2^64 is 20 decimal digits.
  const int max_len = 21;
  char buf[max_len];
  buf[max_len - 1] = '\0';

  uint32_t i;
  for (i = max_len - 2; i >= 0 && x > 0; i--)
  {
    buf[i] = "0123456789"[x % 10];
    x /= 10;
  }

  safe_write(&buf[i + 1]);
}

#ifdef DEBUG
#define DEBUG_WARN_IF_FALSE(cond, msg)          \
  do {                                          \
    if (!(cond)) {                              \
      safe_write(__FILE__);                     \
      safe_write(":");                          \
      safe_write(__LINE__);                     \
      safe_write(" ");                          \
      safe_write(msg);                          \
      safe_write("\n");                         \
    }                                           \
  } while(0)
#else
#define DEBUG_WARN_IF_FALSE(cond, msg)
#endif

uint32_t sLowVirtualMemoryThreshold = 0;
uint32_t sLowCommitSpaceThreshold = 0;
uint32_t sLowPhysicalMemoryThreshold = 0;
uint32_t sLowMemoryNotificationIntervalMS = 0;

uint32_t sNumLowVirtualMemEvents = 0;
uint32_t sNumLowCommitSpaceEvents = 0;
uint32_t sNumLowPhysicalMemEvents = 0;

WindowsDllInterceptor sKernel32Intercept;
WindowsDllInterceptor sGdi32Intercept;

// Has Init() been called?
bool sInitialized = false;

// Has Activate() been called?  The hooks don't do anything until this happens.
bool sHooksActive = false;

// Alas, we'd like to use mozilla::TimeStamp, but we can't, because it acquires
// a lock!
volatile bool sHasScheduledOneLowMemoryNotification = false;
volatile PRIntervalTime sLastLowMemoryNotificationTime;

// These are function pointers to the functions we wrap in Init().

void* (WINAPI *sVirtualAllocOrig)
  (LPVOID aAddress, SIZE_T aSize, DWORD aAllocationType, DWORD aProtect);

void* (WINAPI *sMapViewOfFileOrig)
  (HANDLE aFileMappingObject, DWORD aDesiredAccess,
   DWORD aFileOffsetHigh, DWORD aFileOffsetLow,
   SIZE_T aNumBytesToMap);

HBITMAP (WINAPI *sCreateDIBSectionOrig)
  (HDC aDC, const BITMAPINFO *aBitmapInfo,
   UINT aUsage, VOID **aBits,
   HANDLE aSection, DWORD aOffset);

/**
 * Fire a memory pressure event if it's been long enough since the last one we
 * fired.
 */
bool MaybeScheduleMemoryPressureEvent()
{
  // If this interval rolls over, we may fire an extra memory pressure
  // event, but that's not a big deal.
  PRIntervalTime interval = PR_IntervalNow() - sLastLowMemoryNotificationTime;
  if (sHasScheduledOneLowMemoryNotification &&
      PR_IntervalToMilliseconds(interval) < sLowMemoryNotificationIntervalMS) {

    LOG("Not scheduling low physical memory notification, "
        "because not enough time has elapsed since last one.");
    return false;
  }

  // There's a bit of a race condition here, since an interval may be a
  // 64-bit number, and 64-bit writes aren't atomic on x86-32.  But let's
  // not worry about it -- the races only happen when we're already
  // experiencing memory pressure and firing notifications, so the worst
  // thing that can happen is that we fire two notifications when we
  // should have fired only one.
  sHasScheduledOneLowMemoryNotification = true;
  sLastLowMemoryNotificationTime = PR_IntervalNow();

  LOG("Scheduling memory pressure notification.");
  ScheduleMemoryPressureEvent();
  return true;
}

void CheckMemAvailable()
{
  if (!sHooksActive) {
    return;
  }

  MEMORYSTATUSEX stat;
  stat.dwLength = sizeof(stat);
  bool success = GlobalMemoryStatusEx(&stat);

  DEBUG_WARN_IF_FALSE(success, "GlobalMemoryStatusEx failed.");

  if (success)
  {
    // sLowVirtualMemoryThreshold is in MB, but ullAvailVirtual is in bytes.
    if (stat.ullAvailVirtual < sLowVirtualMemoryThreshold * 1024 * 1024) {
      // If we're running low on virtual memory, unconditionally schedule the
      // notification.  We'll probably crash if we run out of virtual memory,
      // so don't worry about firing this notification too often.
      LOG("Detected low virtual memory.");
      PR_ATOMIC_INCREMENT(&sNumLowVirtualMemEvents);
      ScheduleMemoryPressureEvent();
    }
    else if (stat.ullAvailPageFile < sLowCommitSpaceThreshold * 1024 * 1024) {
      LOG("Detected low available page file space.");
      if (MaybeScheduleMemoryPressureEvent()) {
        PR_ATOMIC_INCREMENT(&sNumLowCommitSpaceEvents);
      }
    }
    else if (stat.ullAvailPhys < sLowPhysicalMemoryThreshold * 1024 * 1024) {
      LOG("Detected low physical memory.");
      if (MaybeScheduleMemoryPressureEvent()) {
        PR_ATOMIC_INCREMENT(&sNumLowPhysicalMemEvents);
      }
    }
  }
}

LPVOID WINAPI
VirtualAllocHook(LPVOID aAddress, SIZE_T aSize,
                 DWORD aAllocationType,
                 DWORD aProtect)
{
  // It's tempting to see whether we have enough free virtual address space for
  // this allocation and, if we don't, synchronously fire a low-memory
  // notification to free some before we allocate.
  //
  // Unfortunately that doesn't work, principally because code doesn't expect a
  // call to malloc could trigger a GC (or call into the other routines which
  // are triggered by a low-memory notification).
  //
  // I think the best we can do here is try to allocate the memory and check
  // afterwards how much free virtual address space we have.  If we're running
  // low, we schedule a low-memory notification to run as soon as possible.

  LPVOID result = sVirtualAllocOrig(aAddress, aSize, aAllocationType, aProtect);

  // Don't call CheckMemAvailable for MEM_RESERVE if we're not tracking low
  // virtual memory.  Similarly, don't call CheckMemAvailable for MEM_COMMIT if
  // we're not tracking low physical memory.
  if ((sLowVirtualMemoryThreshold != 0 && aAllocationType & MEM_RESERVE) ||
      (sLowPhysicalMemoryThreshold != 0 && aAllocationType & MEM_COMMIT)) {
    LOG3("VirtualAllocHook(size=", aSize, ")");
    CheckMemAvailable();
  }

  return result;
}

LPVOID WINAPI
MapViewOfFileHook(HANDLE aFileMappingObject,
                  DWORD aDesiredAccess,
                  DWORD aFileOffsetHigh,
                  DWORD aFileOffsetLow,
                  SIZE_T aNumBytesToMap)
{
  LPVOID result = sMapViewOfFileOrig(aFileMappingObject, aDesiredAccess,
                                     aFileOffsetHigh, aFileOffsetLow,
                                     aNumBytesToMap);
  LOG("MapViewOfFileHook");
  CheckMemAvailable();
  return result;
}

HBITMAP WINAPI
CreateDIBSectionHook(HDC aDC,
                     const BITMAPINFO *aBitmapInfo,
                     UINT aUsage,
                     VOID **aBits,
                     HANDLE aSection,
                     DWORD aOffset)
{
  // There are a lot of calls to CreateDIBSection, so we make some effort not
  // to CheckMemAvailable() for calls to CreateDIBSection which allocate only
  // a small amount of memory.

  // If aSection is non-null, CreateDIBSection won't allocate any new memory.
  bool doCheck = false;
  if (sHooksActive && !aSection && aBitmapInfo) {
    uint16_t bitCount = aBitmapInfo->bmiHeader.biBitCount;
    if (bitCount == 0) {
      // MSDN says bitCount == 0 means that it figures out how many bits each
      // pixel gets by examining the corresponding JPEG or PNG data.  We'll just
      // assume the worst.
      bitCount = 32;
    }

    // |size| contains the expected allocation size in *bits*.  Height may be
    // negative (indicating the direction the DIB is drawn in), so we take the
    // absolute value.
    int64_t size = bitCount * aBitmapInfo->bmiHeader.biWidth *
                              aBitmapInfo->bmiHeader.biHeight;
    if (size < 0)
      size *= -1;

    // If we're allocating more than 1MB, check how much memory is left after
    // the allocation.
    if (size > 1024 * 1024 * 8) {
      LOG3("CreateDIBSectionHook: Large allocation (size=", size, ")");
      doCheck = true;
    }
  }

  HBITMAP result = sCreateDIBSectionOrig(aDC, aBitmapInfo, aUsage, aBits,
                                         aSection, aOffset);

  if (doCheck) {
    CheckMemAvailable();
  }

  return result;
}

class NumLowMemoryEventsReporter : public nsIMemoryReporter
{
  NS_IMETHOD GetProcess(nsACString &aProcess)
  {
    aProcess.Truncate();
    return NS_OK;
  }

  NS_IMETHOD GetKind(int *aKind)
  {
    *aKind = KIND_OTHER;
    return NS_OK;
  }

  NS_IMETHOD GetUnits(int *aUnits)
  {
    *aUnits = UNITS_COUNT_CUMULATIVE;
    return NS_OK;
  }
};

class NumLowVirtualMemoryEventsMemoryReporter : public NumLowMemoryEventsReporter
{
public:
  NS_DECL_ISUPPORTS

  NS_IMETHOD GetPath(nsACString &aPath)
  {
    aPath.AssignLiteral("low-memory-events/virtual");
    return NS_OK;
  }

  NS_IMETHOD GetAmount(int64_t *aAmount)
  {
    // This memory reporter shouldn't be installed on 64-bit machines, since we
    // force-disable virtual-memory tracking there.
    MOZ_ASSERT(sizeof(void*) == 4);

    *aAmount = sNumLowVirtualMemEvents;
    return NS_OK;
  }

  NS_IMETHOD GetDescription(nsACString &aDescription)
  {
    aDescription.AssignLiteral(
      "Number of low-virtual-memory events fired since startup. ");

    if (sLowVirtualMemoryThreshold == 0) {
      aDescription.AppendLiteral(
        "Tracking low-virtual-memory events is disabled, but you can enable it "
        "by giving the memory.low_virtual_mem_threshold_mb pref a non-zero "
        "value.");
    }
    else {
      aDescription.Append(nsPrintfCString(
        "We fire such an event if we notice there is less than %d MB of virtual "
        "address space available (controlled by the "
        "'memory.low_virtual_mem_threshold_mb' pref).  We'll likely crash if "
        "we run out of virtual address space, so this event is somewhat dire.",
        sLowVirtualMemoryThreshold));
    }
    return NS_OK;
  }
};

NS_IMPL_ISUPPORTS1(NumLowVirtualMemoryEventsMemoryReporter, nsIMemoryReporter)

class NumLowCommitSpaceEventsMemoryReporter : public NumLowMemoryEventsReporter
{
public:
  NS_DECL_ISUPPORTS

  NS_IMETHOD GetPath(nsACString &aPath)
  {
    aPath.AssignLiteral("low-commit-space-events");
    return NS_OK;
  }

  NS_IMETHOD GetAmount(int64_t *aAmount)
  {
    *aAmount = sNumLowCommitSpaceEvents;
    return NS_OK;
  }

  NS_IMETHOD GetDescription(nsACString &aDescription)
  {
    aDescription.AssignLiteral(
      "Number of low-commit-space events fired since startup. ");

    if (sLowCommitSpaceThreshold == 0) {
      aDescription.Append(
        "Tracking low-commit-space events is disabled, but you can enable it "
        "by giving the memory.low_commit_space_threshold_mb pref a non-zero "
        "value.");
    }
    else {
      aDescription.Append(nsPrintfCString(
        "We fire such an event if we notice there is less than %d MB of "
        "available commit space (controlled by the "
        "'memory.low_commit_space_threshold_mb' pref).  Windows will likely "
        "kill us if we run out of commit space, so this event is somewhat dire.",
        sLowCommitSpaceThreshold));
    }
    return NS_OK;
  }
};

NS_IMPL_ISUPPORTS1(NumLowCommitSpaceEventsMemoryReporter, nsIMemoryReporter)

class NumLowPhysicalMemoryEventsMemoryReporter : public NumLowMemoryEventsReporter
{
public:
  NS_DECL_ISUPPORTS

  NS_IMETHOD GetPath(nsACString &aPath)
  {
    aPath.AssignLiteral("low-memory-events/physical");
    return NS_OK;
  }

  NS_IMETHOD GetAmount(int64_t *aAmount)
  {
    *aAmount = sNumLowPhysicalMemEvents;
    return NS_OK;
  }

  NS_IMETHOD GetDescription(nsACString &aDescription)
  {
    aDescription.AssignLiteral(
      "Number of low-physical-memory events fired since startup. ");

    if (sLowPhysicalMemoryThreshold == 0) {
      aDescription.Append(
        "Tracking low-physical-memory events is disabled, but you can enable it "
        "by giving the memory.low_physical_memory_threshold_mb pref a non-zero "
        "value.");
    }
    else {
      aDescription.Append(nsPrintfCString(
        "We fire such an event if we notice there is less than %d MB of "
        "available physical memory (controlled by the "
        "'memory.low_physical_memory_threshold_mb' pref).  The machine will start "
        "to page if it runs out of physical memory; this may cause it to run "
        "slowly, but it shouldn't cause us to crash.",
        sLowPhysicalMemoryThreshold));
    }
    return NS_OK;
  }
};

NS_IMPL_ISUPPORTS1(NumLowPhysicalMemoryEventsMemoryReporter, nsIMemoryReporter)

#endif // defined(XP_WIN)

/**
 * This runnable is executed in response to a memory-pressure event; we spin
 * the event-loop when receiving the memory-pressure event in the hope that
 * other observers will synchronously free some memory that we'll be able to
 * purge here.
 */
class nsJemallocFreeDirtyPagesRunnable MOZ_FINAL : public nsIRunnable
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIRUNNABLE
};

NS_IMPL_ISUPPORTS1(nsJemallocFreeDirtyPagesRunnable, nsIRunnable)

NS_IMETHODIMP
nsJemallocFreeDirtyPagesRunnable::Run()
{
  MOZ_ASSERT(NS_IsMainThread());

#if defined(MOZ_MEMORY)
  jemalloc_free_dirty_pages();
#endif

  return NS_OK;
}

/**
 * The memory pressure watcher is used for listening to memory-pressure events
 * and reacting upon them. We use one instance per process currently only for
 * cleaning up dirty unused pages held by jemalloc.
 */
class nsMemoryPressureWatcher MOZ_FINAL : public nsIObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIOBSERVER

  void Init();
};

NS_IMPL_ISUPPORTS1(nsMemoryPressureWatcher, nsIObserver)

/**
 * Initialize and subscribe to the memory-pressure events. We subscribe to the
 * observer service in this method and not in the constructor because we need
 * to hold a strong reference to 'this' before calling the observer service.
 */
void
nsMemoryPressureWatcher::Init()
{
  nsCOMPtr<nsIObserverService> os = services::GetObserverService();

  if (os) {
    os->AddObserver(this, "memory-pressure", /* ownsWeak */ false);
  }
}

/**
 * Reacts to all types of memory-pressure events, launches a runnable to
 * free dirty pages held by jemalloc.
 * @see nsMemoryPressureWatcher::FreeDirtyPages
 */
NS_IMETHODIMP
nsMemoryPressureWatcher::Observe(nsISupports *subject, const char *topic,
                                 const PRUnichar *data)
{
  MOZ_ASSERT(!strcmp(topic, "memory-pressure"), "Unknown topic");

  nsRefPtr<nsIRunnable> runnable = new nsJemallocFreeDirtyPagesRunnable();

  NS_DispatchToMainThread(runnable);

  return NS_OK;
}

} // anonymous namespace

namespace mozilla {
namespace AvailableMemoryTracker {

void Activate()
{
#if defined(_M_IX86) && defined(XP_WIN)
  MOZ_ASSERT(sInitialized);
  MOZ_ASSERT(!sHooksActive);

  // On 64-bit systems, hardcode sLowVirtualMemoryThreshold to 0 -- we assume
  // we're not going to run out of virtual memory!
  if (sizeof(void*) > 4) {
    sLowVirtualMemoryThreshold = 0;
  }
  else {
    Preferences::AddUintVarCache(&sLowVirtualMemoryThreshold,
        "memory.low_virtual_mem_threshold_mb", 128);
  }

  Preferences::AddUintVarCache(&sLowPhysicalMemoryThreshold,
      "memory.low_physical_memory_threshold_mb", 0);
  Preferences::AddUintVarCache(&sLowCommitSpaceThreshold,
      "memory.low_commit_space_threshold_mb", 128);
  Preferences::AddUintVarCache(&sLowMemoryNotificationIntervalMS,
      "memory.low_memory_notification_interval_ms", 10000);

  NS_RegisterMemoryReporter(new NumLowCommitSpaceEventsMemoryReporter());
  NS_RegisterMemoryReporter(new NumLowPhysicalMemoryEventsMemoryReporter());
  if (sizeof(void*) == 4) {
    NS_RegisterMemoryReporter(new NumLowVirtualMemoryEventsMemoryReporter());
  }
  sHooksActive = true;
#endif

  if (Preferences::GetBool("memory.free_dirty_pages", false)) {
    // This object is held alive by the observer service.
    nsRefPtr<nsMemoryPressureWatcher> watcher = new nsMemoryPressureWatcher();
    watcher->Init();
  }
}

void Init()
{
  // Do nothing on x86-64, because nsWindowsDllInterceptor is not thread-safe
  // on 64-bit.  (On 32-bit, it's probably thread-safe.)  Even if we run Init()
  // before any other of our threads are running, another process may have
  // started a remote thread which could call VirtualAlloc!
  //
  // Moreover, the benefit of this code is less clear when we're a 64-bit
  // process, because we aren't going to run out of virtual memory, and the
  // system is likely to have a fair bit of physical memory.

#if defined(_M_IX86) && defined(XP_WIN)
  // Don't register the hooks if we're a build instrumented for PGO: If we're
  // an instrumented build, the compiler adds function calls all over the place
  // which may call VirtualAlloc; this makes it hard to prevent
  // VirtualAllocHook from reentering itself.
  if (!PR_GetEnv("MOZ_PGO_INSTRUMENTED")) {
    sKernel32Intercept.Init("Kernel32.dll");
    sKernel32Intercept.AddHook("VirtualAlloc",
      reinterpret_cast<intptr_t>(VirtualAllocHook),
      (void**) &sVirtualAllocOrig);
    sKernel32Intercept.AddHook("MapViewOfFile",
      reinterpret_cast<intptr_t>(MapViewOfFileHook),
      (void**) &sMapViewOfFileOrig);

    sGdi32Intercept.Init("Gdi32.dll");
    sGdi32Intercept.AddHook("CreateDIBSection",
      reinterpret_cast<intptr_t>(CreateDIBSectionHook),
      (void**) &sCreateDIBSectionOrig);
  }

  sInitialized = true;
#endif
}

} // namespace AvailableMemoryTracker
} // namespace mozilla


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>gov.nasa.jpl.memex</groupId>
  <artifactId>pooled-time-series</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>pooled-time-series</name>
  <url>http://maven.apache.org</url>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <!-- NOTE: We don't need a groupId specification because the group is
             org.apache.maven.plugins ...which is assumed by default.
         -->
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.5.4</version>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <archive>
            <manifest>
              <mainClass>gov.nasa.jpl.memex.pooledtimeseries.PoT</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>nu.pattern</groupId>
      <artifactId>opencv</artifactId>
      <version>2.4.9-4</version>
   </dependency>
	<dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
	</dependency>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1.1</version>
    </dependency>
  </dependencies>
</project>


text:
import curses
import datetime
import traceback

from .getTimerDate import runDay
from .getTimerTime import runTime
from .getTimerDateTime import runDateTime

__all__ = ['getUserDate', 'getUserTime', 'getUserDateTime']

def _startWindow():
    stdscr = curses.initscr()
    curses.noecho()
    curses.cbreak()
    stdscr.keypad(1)
    curses.curs_set(0)
    return stdscr

def _stopWindow(stdscr):
    stdscr.erase()
    stdscr.refresh()
    stdscr.keypad(0)
    curses.echo()
    curses.curs_set(1)
    curses.nocbreak()
    curses.endwin()

def _cleanup():
    curses.echo()
    curses.curs_set(1)
    curses.nocbreak()
    curses.endwin()
    traceback.print_exc()

def getUserDate(start=None, rollover=False,
                topString="Input your Date",
                bottomString="Press Enter when done"):
    try:
        scr = _startWindow()
        d = runDay(scr, rollover, topString, bottomString, start)
        _stopWindow(scr)
        return d
    except:
        _cleanup()

def getUserTime(start=None, rollover=False,
                topString="Input your Time",
                bottomString="Press Enter when done"):
    try:
        scr = _startWindow()
        d = runTime(scr, rollover, topString, bottomString, start)
        _stopWindow(scr)
        return d
    except:
        _cleanup()

def getUserDateTime(start=None, rollover=False,
                    topString="Input your Timestamp",
                    bottomString="Press Enter when done"):
    try:
        scr = _startWindow()
        d = runDateTime(scr, rollover, topString, bottomString, start)
        _stopWindow(scr)
        return d
    except:
        _cleanup()


text:
package com.nflabs.zeppelin.zengine.stmt;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.nflabs.zeppelin.zengine.ZException;
import com.nflabs.zeppelin.zengine.Zengine;
import com.nflabs.zeppelin.zengine.stmt.AnnotationStatement;
import com.nflabs.zeppelin.zengine.stmt.AnnotationStatement.ANNOTATION;
import com.nflabs.zeppelin.zengine.stmt.AnnotationStatement.COMMAND;

public class AnnotationStatementTest {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testAnnotation() throws ZException {
		Zengine z = new Zengine();
		AnnotationStatement a = new AnnotationStatement("@driver set hive");
		assertEquals(ANNOTATION.DRIVER, a.getAnnotation());
		assertEquals(COMMAND.SET, a.getCommand());
		assertEquals("hive", a.getArgument());
	}

	@Test
	public void testAnnotationEmptyArg() throws ZException {
		Zengine z = new Zengine();
		AnnotationStatement a = new AnnotationStatement("@driver set");
		assertEquals(ANNOTATION.DRIVER, a.getAnnotation());
		assertEquals(COMMAND.SET, a.getCommand());
		assertEquals(null, a.getArgument());
	}

	@Test
	public void testInvalidAnnotation() throws ZException {
		Zengine z = new Zengine();
		AnnotationStatement a;
		try {
			a = new AnnotationStatement("@worng set hive");
			fail();
		} catch (ZException e) {
			// expected
		}
	}

	@Test
	public void testInvalidCommand() throws ZException {
		Zengine z = new Zengine();
		AnnotationStatement a;
		try {
			a = new AnnotationStatement("@driver wrong hive");
			fail();
		} catch (ZException e) {
			// expected
		}
	}
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.curso.java.entidades.relaciones.bidireccional.onetomany;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 *
 * @author jose maria
 */
@Entity
public class Modulo implements Serializable {

    @ManyToOne
    private Programa programa;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    private Long id;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modulo)) {
            return false;
        }
        Modulo other = (Modulo) object;
        return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
    }

    @Override
    public String toString() {
        return "entidades.relaciones.bidireccional.onetomany.Modulo[id=" + id + "]";
    }
}