text:
if (location.protocol != 'https:')
{
 location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
}

var txt = ["Search For....","Queen Anne","Pioneer Square","Sushi", "Micro-Brew","Cocktail Bars","find me a BEER......", "GET ME DRUNK!!!"];
var timeOut;
var counter =0;
var char = 0;
var num=0;
var time=0;
var endFlag=false;
// var thisID;
// var nowTime;

$('#searchBox').attr('placeholder', '|');
var humanize = Math.round(Math.random() * (200 - 24)) + 30;
function typeIt(x) {
  if ((char === x.length)&&(num<=txt.length-2)) {
    clearTimeout(timeOut);
    // console.log('done');
    removeIt();
  }
  else{
    timeOut = setTimeout(function () {
    char++;
    var type = x.substring(0, char);
    $('#searchBox').attr('placeholder', type + '|');
    typeIt(x);
    // console.log(counter);
      if((counter===txt.length)&&(char===txt[num].length)){
        clearTimeout(timeOut);
        $('#searchBox').attr('placeholder', $('#searchBox').attr('placeholder').slice(0, -1));
        // console.log(counter);
      }
    // console.log('running');
  },humanize);
  }
}
function removeIt(){
  timeOut = setTimeout(function () {
      char--;
      $('#searchBox').attr('placeholder', $('#searchBox').attr('placeholder').slice(0, -1));
      removeIt();
    },humanize);
    if(char<0){
      clearTimeout(timeOut);
      num++;
      time++;
      // console.log(num);
      typeOut();
    }
  //  console.log('test');
}

function typeOut(){
  while((num === time)&&(num<=txt.length-1)){
    typeIt(txt[num]);
    counter++;
    break;
  }
}

typeOut();

function removeCursor(){
  $('#searchBox').attr('placeholder', $('#searchBox').attr('placeholder').slice(0, -1));
}

$("#searchBox").keyup(function(event) {
  searchParser.bind(this)();
});

$('.loadingImage').hide();  // Hide it initially
$(document).ajaxStart(function() {
  $('.loadingImage').show();
  $('body').css('cursor', 'wait');
  console.log('request started');
});
$(document).ajaxStop(function() {
  $('.loadingImage').hide();
  $('body').css('cursor', 'auto');
  console.log('request stopped');
});

$('li').hover(function() {
  $(this).toggleClass('pulse animated');
});

$('.resultBox').hover(function() {
  $(this).toggleClass('pulse animated');
});

$('.resultsInfo').on('click', function(event) {
  // console.log('working event');
  locationId = $(this).find('.resultAddress').text();
  var dropdown = $(this).find('select');
  console.log('place picked');
  console.log($(this));
  mapSize();
  $('#resultsOuterBox').hide();
  $('#mapView').show();
  $('#searchBox').hide();
  $('#backButton').show();
  initMap();
  $('#backButton').on('click', function(event) {
    $('#resultsOuterBox').show();
    $('#mapView').hide();
    $('#searchBox').show();
    $('#backButton').hide();
  });
});

function getParameterByName(name, url) {
  if (!url) url = window.location.href;
  name = name.replace(/[\[\]]/g, "\\$&");
  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
      results = regex.exec(url);
  if (!results) return null;
  if (!results[2]) return '';
  return decodeURIComponent(results[2].replace(/\+/g, " "));
}

function countDown(id) {
  var deadline;
  var location = id;
  var time;
  var timeNow = moment().format('h');
  var amPm = moment().format('a');
  var toDay = moment().format('dddd');
  if (amPm === 'pm') {
    if (timeNow !== '12') {
      timeNow = Number(timeNow)+12;
      // console.log(timeNow);
    }
  }
  uniqueArray.forEach(function (x, day) {
    // console.log('hello');
    if ("#"+x.id === location) {
      // console.log(x.id);
      // console.log(amPm);
      // console.log(Number(x.happyHour[toDay][0][0].split(':',1)) +"<="+Number(timeNow)+ "<="+ Number(x.happyHour[toDay][1][0].split(':',1)));

      if ((Number(x.happyHour[toDay][0][0].split(':',1)) <= Number(timeNow)) && (Number(timeNow) <= Number(x.happyHour[toDay][1][0].split(':',1)))) {
        time = x.happyHour[toDay][1][0];
        // console.log(time);
        if (Number(time.split(':',1)) >= 24) {
          // console.log('next day');
          var changeTime = moment().format('LL');
          var splitTime = changeTime.split(' ');
          var newDay = Number(splitTime[1].split(',',1))+1;
          var newDate = splitTime[0]+' '+ newDay+', '+ splitTime[2];
          var hours = Number(time.split(':',1)) - 24;
          deadline = newDate + ' ' + hours +':00';
          // console.log(deadline);
        }
        else{
          deadline = moment().format('LL') + ' '+ time+':00';
          // console.log(deadline);
        }
      }
      else if (x.happyHour[toDay][1].length === 2){
        if ((Number(x.happyHour[toDay][0][1].split(':',1)) <= Number(timeNow)) && (Number(timeNow) <= Number(x.happyHour[toDay][1][1].split(':',1)))) {
          // console.log(Number(x.happyHour[toDay][0][1].split(':',1)));
          // console.log(Number(timeNow));
          // console.log(Number(x.happyHour[toDay][1][1].split(':',1)));
          time = x.happyHour[toDay][1][1];
          if (Number(time.split(':',1)) >= 24) {
            // console.log('next day');
            var changeTime = moment().format('LL');
            var splitTime = changeTime.split(' ');
            var newDay = Number(splitTime[1].split(',',1))+1;
            var newDate = splitTime[0]+' '+ newDay+', '+ splitTime[2];
            console.log(Number(time.split(':',1)));
            var hours = Number(time.split(':',1)) - 24;
            deadline = newDate + ' ' + hours +':59';
            // console.log(deadline);
          }
          else{
            deadline = moment().format('LL') + ' '+ time+':00';
            // console.log(deadline);
          }
        }
      }
    }
  });
  function getTimeRemaining (deadline){
    // console.log(Date.parse(deadline));
    // console.log(deadline);
    var t = Date.parse(deadline) - Date.parse(new Date());
    // console.log(deadline);
    // console.log(t);
    var seconds = Math.floor((t/1000)%60);
    var minutes = Math.floor((t/1000/60)%60);
    var hours = Math.floor((t/(1000*60*60))%24);
    var days = Math.floor(t/(1000*60*60*24));
    return {
      'total': t,
      'hours': hours,
      'minutes': minutes,
      'seconds': seconds
    };
  }

  function updateClock(){
      var t = getTimeRemaining(deadline);
      // console.log(t.total);
      if (isNaN(t.total)) {
        console.log(t +' cleared');
        clearInterval(timeinterval);
        timeinterval = 0;
      }
      // console.log(location);
      $(location).find('.hours').text(t.hours);
      $(location).find('.minutes').text(('0' + t.minutes).slice(-2));
      $(location).find('.seconds').text(('0' + t.seconds).slice(-2));
      if(t.total<=0){
        clearInterval(timeinterval);
      }
      $('#searchBox').keypress(function(event) {
        if(event.which===13){
          console.log('clear');
          clearInterval(timeinterval);
          timeinterval = 0;
        }
      });

      $('#searchIcon').click(function(){
        console.log('clear');
        clearInterval(timeinterval);
        timeinterval = 0;
      });
  }
  updateClock(location); // run function once at first to avoid delay
  var timeinterval = setInterval(updateClock,1000);
}

function scrollHappening() { /// insure to bind this to the element being calling it
  if(($(this).scrollTop() + $(this).innerHeight()>=$(this)[0].scrollHeight-1) && (endFlag === false)){
    // console.log('happening');
    endFlag = true;
    // console.log($('#results').children(':last-child').attr('id'));
    if (User.reqNeighborhood) {
      var lastResult = $('#results').children(':last-child').attr('id');
      console.log(lastResult);
      uniqueArray.forEach(function(v) {
        if (v.id === lastResult) {
          // console.log(lastResult);
          lastResult = v.coordinate;
        }
      });
      console.log(lastResult);
      if (User.moreSearch) {
        User.moreSearch.sw_latitude = lastResult.latitude -0.014;
        User.moreSearch.ne_latitude = lastResult.latitude +0.014;
        User.moreSearch.sw_longitude = lastResult.longitude -0.014;
        User.moreSearch.ne_longitude = lastResult.longitude +0.014;
        console.log(User.reqNeighborhood);
      }
      else{
        User.moreSearch = {sw_latitude: lastResult.latitude - 0.014,
        ne_latitude :lastResult.latitude + 0.014,
        sw_longitude : lastResult.longitude - 0.014,
        ne_longitude : lastResult.longitude + 0.014};
      }
    }
    else{
      if (User.moreSearch) {
        User.moreSearch.sw_latitude = User.moreSearch.sw_latitude -0.014;
        User.moreSearch.ne_latitude = User.moreSearch.ne_latitude +0.014;
        User.moreSearch.sw_longitude = User.moreSearch.sw_longitude -0.014;
        User.moreSearch.ne_longitude = User.moreSearch.ne_longitude +0.014;
      }
      else{
        User.moreSearch = {sw_latitude: User.currectLoc.split(',')[0]- 0.014,
        ne_latitude :Number(User.currectLoc.split(',')[0]) + 0.014,
        sw_longitude : User.currectLoc.split(',')[1] - 0.014,
        ne_longitude : Number(User.currectLoc.split(',')[1]) + 0.014};
      }
    }
    User.reqNeighborhood = undefined;
    // console.log(lastResult);
    $.post( "/resultsMore",{searchCrit:User}, function(data) {
      console.log( "success" );
    })
      .done(function(data) {
        $('#resultsOuterBox').show();
        console.log("Server Success" );
        // console.log(data);
        if (data.hasOwnProperty('statusCode')){
          console.warn("Error was logged when trying to retrieve results from the Yelp API: "+ data.data);
          alert("There was a problem processing your request. Please try again or check the console for more information");
        }
        else {
          var moreArray = [];
          var uniqueMoreArray = [];
          var newResults = [];
          console.log('event 243 forEach');
          data.forEach(function(x){
              happyHourArray.forEach(function(y) {
                if (x.id === y.id) {
                  // console.log(y);
                  // console.log(y.logo);
                  // console.log(y.website);
                  x.happyHour=y.happyHour;
                  x.img = y.logo;
                  x.website = y.website;
                  var place = new Places(x);
                  // console.log(place);
                  moreArray.push(place);
                }
              });
            });
            uniqueMoreArray=_.uniq(moreArray,function(x){
              return x.name;
            });
            uniqueMoreArray.forEach(function(u) {
              var count = 0;
              uniqueArray.forEach(function(a){
                if (u.id !== a.id) {
                  count++;
                  // console.log('same');
                }
                if (count === uniqueArray.length) {
                  newResults.push(u);
                  uniqueArray.push(u);
                }
              });
            });
            hhNow(uniqueArray);
            hhTimes(uniqueArray);
          var template = $('#restTemplate').html();
          var compileTemplate = Handlebars.compile(template);
          newResults.forEach(function(each) {
            var html = compileTemplate(each);
            $('#results').append(html);
            var eachId = each.id;
            each.happyHourTimes.forEach(function(index){
              $('#'+eachId+' .happyHoursIcons').append("
"+index.day+"
");
            });
            $('#results').addClass('fadeInUpBig animated');
            var times = $('#'+eachId+' .'+day).attr('value');
            $('#'+eachId+' .happyHTimes').text(times);
          });
          happening.forEach(function(x){
            var id = x;
            $(x).find('.hHDropDown').addClass('happeningNow');
            $(x).find('.clock').css('display', 'block');
            countDown(id);
          });
          $('.'+day).css('background-color', 'rgba(255, 0, 0, 0.81)');
          endFlag = false;
        }
        $('.mapIcon').unbind('click');
        $('.resultTitle').unbind('click');
        mapFunction();
        $('.timesIcon').unbind('mouseenter mouseleave');
        daysHover();
      });
  }
}

if((window.location.href.indexOf('search/index.html') > -1)||(window.location.href.indexOf('search/?undefined') > -1)){
  window.open("/", '_self');
}

if((window.location.href.indexOf('about') > -1)||(window.location.href.indexOf('about/') > -1)){
  $('#iframeAPIplayer').css('display', 'none');
  $('#iframeAPIplayer').remove();
  $('body').css('background-image', 'url(' + bgroundImg[Math.floor(Math.random() * bgroundImg.length)] +')');
  $('.loadingImage').hide();
  $('.backgroundVid').hide();
  $('#searchBoxWrapper').hide();
  $('#outerBox').hide();
  $('#about-page').css('display', 'flex');
  $('#about-page').show('slow');
  $('#siteseal').hide();
}

if((window.location.href.indexOf('new-edit') > -1)||(window.location.href.indexOf('new-edit/') > -1)){
  $('#iframeAPIplayer').css('display', 'none');
  $('#iframeAPIplayer').remove();
  $('body').css('background-image', 'url(' + bgroundImg[Math.floor(Math.random() * bgroundImg.length)] +')');
  $('.loadingImage').hide();
  $('.backgroundVid').hide();
  $('#searchBoxWrapper').hide();
  $('#outerBox').hide();
  $('#about-page').hide();
  $('#addEdit').css('display', 'flex');
  $('#addEdit').show('slow');
  $('#siteseal').hide();
  sendNewLocation();
}

if(window.location.href.indexOf('search/?') > -1){
  $('#iframeAPIplayer').css('display', 'none');
  $('#iframeAPIplayer').remove();
  $('#siteseal').hide();
  User.terms = getParameterByName('terms');
  var mapLocation = getParameterByName('locationID');
  console.log(mapLocation);
  console.log(User.terms);
  if (getParameterByName('reqNeighborhood')) {
    console.log('reqNeb');
    User.reqNeighborhood = getParameterByName('reqNeighborhood');
  }
  if (User.reqNeighborhood===undefined) {
    User.reqNeighborhood = undefined;
  }
  else {
  User.reqNeighborhood = getParameterByName('reqNeighborhood');
  }
  // if (User.currectLoc===""){
  //   console.log('blank string');
  //   User.currectLoc=undefined;
  //   }
  // else{
    User.currectLoc = getParameterByName('currectLoc');
    console.log(User.currectLoc);
  // }
  // console.log(User.currectLoc);
  if (User.currectLoc !== undefined) {
    userLat=User.currectLoc.split(',')[0];
    userLong=User.currectLoc.split(',')[1];
    User.currectLoc = {lat: User.currectLoc.split(',')[0], long: User.currectLoc.split(',')[1]};
  }
  yelpSearchResults=[];
  reducedArray = [];
  resultsArray=[];
  console.log('User: ');
  console.log(User);
  $.post( "/search",{searchCrit:User}, function(data) {
    console.log( "success" );
  })
    .done(function(data) {
      $('#resultsOuterBox').show();
      getLocation();
      $('body').css('background-image', 'url(' + bgroundImg[Math.floor(Math.random() * bgroundImg.length)] +')');
      // console.log("Server Success" );
      // console.log(data.url);
      console.log(data.yelp);
      //changes
      // window.history.pushState("search/" + data.url," ","search/?" + data.url);
      if (data.yelp.hasOwnProperty('statusCode')){
        console.warn("Error was logged when trying to retrieve results from the Yelp API: "+ data.yelp.data);
        alert("There was a problem processing your request. Please try again or check the console for more information");
      }
      else {
        data.yelp.forEach(function(x){
            happyHourArray.forEach(function(y) {
              if (x.id === y.id) {
                // console.log(y);
                // console.log(y.logo);
                // console.log(y.website);
                x.happyHour=y.happyHour;
                x.img = y.logo;
                x.website = y.website;
                var place = new Places(x);
                // console.log(place);
                resultsArray.push(place);
              }
            });
          });
          hhNow(resultsArray);
          if (resultsArray.length === 0) {
            // console.log('working');
            $('#results').html('
Search Again...
');
          }

          hhTimes(resultsArray);
          // console.log(resultsArray);
          uniqueArray=_.uniq(resultsArray,function(x){
            return x.name;
          });
          $('.backgroundVid').css('background-color', 'rgba(250, 250, 250, 0)');
          $('.fullscreen-bg__video').addClass('fadeOutUp animated');
          setTimeout(function() {
            $('.fullscreen-bg__video').hide();
          },540);
          $('#searchBoxWrapper').css('margin-top', '1%');
          var template = $('#restTemplate').html();
          var compileTemplate = Handlebars.compile(template);
          Handlebars.registerHelper("happyHourTimes", function(x) {
              return x;
          });
          uniqueArray.forEach(function(each) {
            var html = compileTemplate(each);
            $('#results').append(html);
            var eachId = each.id;
            each.happyHourTimes.forEach(function(index){
              $('#'+eachId+' .happyHoursIcons').append("
"+index.day+"
");
            });
            $('#results').addClass('fadeInUpBig animated');
            happening.forEach(function(x){
              var id = x;
              $(x).find('.hHDropDown').addClass('happeningNow');
              $(x).find('.clock').css('display', 'block');
              countDown(id);
            });
            $('.'+day).css('background-color', 'rgba(255, 0, 0, 0.81)');
            var times = $('#'+eachId+' .'+day).attr('value');
            $('#'+eachId+' .happyHTimes').text(times);
            // console.log(each);
          });
          $('#resultsOuterBox').scroll(function(){
            scrollHappening.bind(this)();
          });

          daysHover();
          resultSizeChange();

          mapFunction();
          if (mapLocation !== null) {
            if (userLat === undefined) {
              User.currectLoc = getParameterByName('currectLoc');
              userLat=User.currectLoc.split(',')[0];
              userLong=User.currectLoc.split(',')[1];
            }
            console.log(userLat);
            locationId = $('#results').find('#'+mapLocation).find('.resultAddress').text();
            locationsName = $('#results').find('#'+mapLocation).find('.resultTitle').text();
            function resultsinfoFunction() {
              return location.href;
            }
            resultsInfoLocation = resultsinfoFunction();
            var resultsInfoArray = resultsInfoLocation.split('&');
            resultsInfo = resultsInfoArray[0]+'&'+resultsInfoArray[1]+'&'+resultsInfoArray[2];
            console.log(resultsInfo);
            // GotToMap();
          }
      }
  })
    .fail(function() {
      alert("Error Communicating With Server");
    })
    .always(function() {
      // console.log("finished");
  });
}

$('#aboutBut').click(function() {
  /* Act on the event */
  // console.log('clicked');
  // $('body').css('background-image', 'url(' + bgroundImg[Math.floor(Math.random() * bgroundImg.length)] +')');
  // $('.loadingImage').hide();
  // $('.backgroundVid').hide();
  // $('#searchBoxWrapper').hide();
  // $('#outerBox').hide();
  // $('#about-page').show('slow');
});

$('#newEditBut').click(function(event) {
  $('#siteseal').hide();
  /* Act on the event */
  // event.preventDefault();
  // $('body').css('background-image', 'url(' + bgroundImg[Math.floor(Math.random() * bgroundImg.length)] +')');
  // $('.loadingImage').hide();
  // $('.backgroundVid').hide();
  // $('#searchBoxWrapper').hide();
  // $('#outerBox').hide();
  // $('#about-page').hide();
  // $('#addEdit').css('display', 'flex');
  // $('#addEdit').show('slow');
  // sendNewLocation();
});


text:
package com.esri.gpt.catalog.publication;
import com.esri.gpt.catalog.arcgis.metadata.AGSProcessor;
import com.esri.gpt.catalog.arcgis.metadata.AGSProcessorConfig;
import com.esri.gpt.framework.collection.StringAttributeMap;
import com.esri.gpt.framework.http.CredentialProvider;
import com.esri.gpt.framework.http.HttpClientRequest;
import com.esri.gpt.framework.security.credentials.UsernamePasswordCredentials;
import com.esri.gpt.framework.util.Val;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * A factory for instantiating suitable resource processors.
 */
public class ProcessorFactory {

  /** constructors ============================================================ */

  /** Default constructor. */
  public ProcessorFactory() {}

  /**
   * Interrogates a resource URL to determine an appropriate resource processor.
   * @param context the resource processing context
   * @param resourceUrl the resource URL to be interrogated
   * @return a processor capable of handling the endpoint (can be null)
   * @throws IOException if a communication exception occurs
   */
  public ResourceProcessor interrogate(ProcessingContext context, String resourceUrl)
    throws IOException {
    return interrogate(context, resourceUrl, null);
  }

  /**
   * Interrogates a resource URL to determine an appropriate resource processor.
   * @param context the resource processing context
   * @param resourceUrl the resource URL to be interrogated
   * @param credentials credentials
   * @return a processor capable of handling the endpoint (can be null)
   * @throws IOException if a communication exception occurs
   */
  public ResourceProcessor interrogate(ProcessingContext context, String resourceUrl, UsernamePasswordCredentials credentials)
    throws IOException {

    // it's xml or ags json or ags soap

    // determine the base URL (sans query string)
    resourceUrl = Val.chkStr(resourceUrl);
    String baseUrl = resourceUrl;
    if (baseUrl.indexOf("?") != -1) {
      baseUrl = baseUrl.substring(0,baseUrl.indexOf("?"));
    }
    if (baseUrl.endsWith("/")) {
      baseUrl = baseUrl.substring(0,baseUrl.length() - 1);
    }

    // determine the protocol
    boolean isHttpProtocol = false;
    boolean isFtpProtocol = false;
    boolean isFileProtocol = false;
    boolean isFile = false;
    boolean isDirectory = false;
    boolean wasMalformed = false;
    boolean isWMS = false;
    URL url = null;
    File file = null;
    try {
      url = new URL(resourceUrl);
      String protocol = Val.chkStr(url.getProtocol()).toLowerCase();
      isHttpProtocol = protocol.equals("http") || protocol.equals("https");
      isFtpProtocol = protocol.equals("ftp") || protocol.equals("ftps");
      isFileProtocol = protocol.equals("file");
      isWMS = url.getQuery()!=null? url.getQuery().toLowerCase().contains("service=wms") || url.getQuery().toLowerCase().contains("service=wmts"): false;
    } catch (MalformedURLException e) {
      wasMalformed = true;
    }

    // check to see if this is a reference to a server side file or directory
    // TODO: should we allow this??
    if (isFileProtocol || wasMalformed) {
      String filePath = resourceUrl;
      if (isFileProtocol) {
        filePath = url.getPath();
      }
      try {
        file = new File(filePath);
        if (file.exists()) {
          isFile = file.isFile();
          isDirectory = file.isDirectory();
        }
      } catch (SecurityException se) {
        // read only
      }
    }

    if (isDirectory) {
      // no applicable processor
    } else if (isWMS) {
      WMSProcessor wmsp = new WMSProcessor(context, resourceUrl);
      return wmsp;
    } else if (isFile) {
      SingleXmlProcessor xp = new SingleXmlProcessor(context,file);
      return xp;
    } else if (isFtpProtocol) {
      // no applicable processor
    } else if (isHttpProtocol) {
      return this.interrogateHttpEndpoint(context,url,credentials);
    } else {
      // no applicable processor
    }

    return null;
  }

  /**
   * Interrogates an HTTP endpoint.
   * @param context the resource processing context
   * @param url the URL to be interrogated
   * @param credentials credentials
   * @return a processor capable of handling the endpoint (can be null)
   * @throws IOException if a communication exception occurs
   */
  private ResourceProcessor interrogateHttpEndpoint(ProcessingContext context, URL url, UsernamePasswordCredentials credentials)
    throws IOException {

    // read the character response from the endpoint
    String fullUrl = url.toExternalForm();
    HttpClientRequest httpClient = context.getHttpClient();
    httpClient.setUrl(fullUrl);
    httpClient.setCredentialProvider(
      credentials==null || credentials.getUsername().length()==0 || credentials.getPassword().length()==0?
        null:
        new CredentialProvider(credentials.getUsername(),credentials.getPassword())
    );
    String response = Val.chkStr(httpClient.readResponseAsCharacters());

    if (response.length() > 0) {

      // first try ArcGIS Server
      boolean interrofgateAGS = true;
      StringAttributeMap params = context.getRequestContext().getCatalogConfiguration().getParameters();
      if (Val.chkStr(params.getValue("AGSProcessor.interrogation.enabled")).equalsIgnoreCase("false")) {
        interrofgateAGS = false;
      } else if (!AGSProcessorConfig.isAvailable()) {
        interrofgateAGS = false;
      }
      if (interrofgateAGS) {
        AGSProcessor ags = new AGSProcessor(context);
        ags.setCredentials(credentials);
        try {
          if (ags.interrogate(url,response)) {
            return ags;
          }
        } catch (IOException ioe) {
          if (ags.getTarget().getWasRecognized()) {
            throw ioe;
          }
        }
      }

    }

    // default to s single xml processor
    SingleXmlProcessor xp = new SingleXmlProcessor(context,url.toExternalForm(),response);
    return xp;
  }

}

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.codeInspection.reference;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Key;
import com.intellij.psi.*;
import com.intellij.psi.util.ClassUtil;
import com.intellij.psi.util.PsiFormatUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * @author max
 * Date: Oct 21, 2001
 */
public class RefFieldImpl extends RefJavaElementImpl implements RefField {
  private static final int USED_FOR_READING_MASK = 0x10000;
  private static final int USED_FOR_WRITING_MASK = 0x20000;
  private static final int ASSIGNED_ONLY_IN_INITIALIZER = 0x40000;

  RefFieldImpl(@NotNull RefClass ownerClass, PsiField field, RefManager manager) {
    super(field, manager);

    ((RefClassImpl)ownerClass).add(this);

    if (ownerClass.isInterface()) {
      setIsStatic(true);
      setIsFinal(true);
    }
    if (field instanceof PsiEnumConstant) {
      putUserData(ENUM_CONSTANT, true);
    }
  }

  @Override
  public PsiField getElement() {
    return (PsiField)super.getElement();
  }

  @Override
  protected void markReferenced(RefElementImpl refFrom, PsiElement psiFrom, PsiElement psiWhat, boolean forWriting, boolean forReading, PsiReferenceExpression expressionFrom) {
    addInReference(refFrom);

    boolean referencedFromClassInitializer = false;

    if (forWriting && expressionFrom != null) {
      PsiClassInitializer initializer = PsiTreeUtil.getParentOfType(expressionFrom, PsiClassInitializer.class);
      if (initializer != null) {
        if (initializer.getParent() instanceof PsiClass && psiFrom == initializer.getParent() && !expressionFrom.isQualified()) {
          referencedFromClassInitializer = true;
        }
      }
    }

    if (forWriting) {
      setUsedForWriting(true);
    }

    if (forReading) {
      setUsedForReading(true);
    }
    getRefManager().fireNodeMarkedReferenced(this, refFrom, referencedFromClassInitializer, forReading, forWriting);
  }

  @Override
  public boolean isUsedForReading() {
    return checkFlag(USED_FOR_READING_MASK);
  }

  private void setUsedForReading(boolean usedForReading) {
    setFlag(usedForReading, USED_FOR_READING_MASK);
  }

  @Override
  public boolean isUsedForWriting() {
    return checkFlag(USED_FOR_WRITING_MASK);
  }

  private void setUsedForWriting(boolean usedForWriting) {
    setFlag(false, ASSIGNED_ONLY_IN_INITIALIZER);
    setFlag(usedForWriting, USED_FOR_WRITING_MASK);
  }

  @Override
  public boolean isOnlyAssignedInInitializer() {
    return checkFlag(ASSIGNED_ONLY_IN_INITIALIZER);
  }

  @Override
  public void accept(@NotNull final RefVisitor visitor) {
    if (visitor instanceof RefJavaVisitor) {
      ApplicationManager.getApplication().runReadAction(new Runnable() {
        @Override
        public void run() {
          ((RefJavaVisitor)visitor).visitField(RefFieldImpl.this);
        }
      });
    }  else {
      super.accept(visitor);
    }
  }

  @Override
  public void buildReferences() {
    PsiField psiField = getElement();
    if (psiField != null) {
      final RefJavaUtil refUtil = RefJavaUtil.getInstance();
      refUtil.addReferences(psiField, this, psiField.getInitializer());
      refUtil.addReferences(psiField, this, psiField.getModifierList());
      if (psiField instanceof PsiEnumConstant) {
        refUtil.addReferences(psiField, this, psiField);
      }

      if (psiField.getInitializer() != null || psiField instanceof PsiEnumConstant) {
        if (!checkFlag(USED_FOR_WRITING_MASK)) {
          setFlag(true, ASSIGNED_ONLY_IN_INITIALIZER);
          setFlag(true, USED_FOR_WRITING_MASK);
        }
      }
      PsiType psiType = psiField.getType();
      RefClass ownerClass = refUtil.getOwnerClass(getRefManager(), psiField);

      if (ownerClass != null) {
        psiType = psiType.getDeepComponentType();
        if (psiType instanceof PsiClassType) {
          PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
          if (psiClass != null && getRefManager().belongsToScope(psiClass)) {
              RefClassImpl refClass = (RefClassImpl)getRefManager().getReference(psiClass);
            if (refClass != null) {
              refClass.addTypeReference(ownerClass);
              refClass.addClassExporter(this);
            }
          }
        }

      }
      getRefManager().fireBuildReferences(this);
    }
  }

  @Override
  public RefClass getOwnerClass() {
    return (RefClass) getOwner();
  }

  @Override
  public String getExternalName() {
    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      @Override
      public String compute() {
        PsiField psiField = getElement();
        return psiField != null ? PsiFormatUtil.getExternalName(psiField) : null;
      }
    });
  }

  @Nullable
  public static RefField fieldFromExternalName(RefManager manager, String externalName) {
    return (RefField)manager.getReference(findPsiField(PsiManager.getInstance(manager.getProject()), externalName));
  }

  @Nullable
  public static PsiField findPsiField(PsiManager manager, String externalName) {
    int classNameDelimeter = externalName.lastIndexOf(' ');
    if (classNameDelimeter > 0 && classNameDelimeter < externalName.length() - 1) {
      final String className = externalName.substring(0, classNameDelimeter);
      final String fieldName = externalName.substring(classNameDelimeter + 1);
      final PsiClass psiClass = ClassUtil.findPsiClass(manager, className);
      if (psiClass != null) {
        return psiClass.findFieldByName(fieldName, false);
      }
    }
    return null;
  }

  @Override
  public boolean isSuspicious() {
    if (isEntry()) return false;
    if (super.isSuspicious()) return true;
    return isUsedForReading() != isUsedForWriting();
  }

  @Override
  protected void initialize() {
  }
}


text:
<?php

/**
 * Class NumberTreeFixture
 *
 * Generates a tree of data for use testing the tree behavior
 *
 * @package       Cake.Test.Fixture
 */
class NumberTreeFixture extends CakeTestFixture {

/**
 * fields property
 *
 * @var array
 */
	public $fields = array(
		'id'	=> array('type' => 'integer', 'key' => 'primary'),
		'name'	=> array('type' => 'string', 'null' => false),
		'parent_id' => 'integer',
		'lft'	=> array('type' => 'integer', 'null' => false),
		'rght'	=> array('type' => 'integer', 'null' => false)
	);
}


text:
package com.jcommerce.gwt.client.panels.promote;

//import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Label;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.TextBox;
import com.jcommerce.gwt.client.ContentWidget;
import com.jcommerce.gwt.client.ModelNames;
import com.jcommerce.gwt.client.PageState;
import com.jcommerce.gwt.client.form.BeanObject;
import com.jcommerce.gwt.client.model.IFavourableActivity;
import com.jcommerce.gwt.client.resources.Resources;
import com.jcommerce.gwt.client.service.Criteria;
import com.jcommerce.gwt.client.service.DeleteService;
import com.jcommerce.gwt.client.service.ListService;
import com.jcommerce.gwt.client.service.PagingListService;
import com.jcommerce.gwt.client.widgets.ActionCellRenderer;
import com.jcommerce.gwt.client.widgets.ColumnPanel;

public class FavourableActivityListPanel extends ContentWidget{

	private ColumnPanel contentPanel = new ColumnPanel();
	private Criteria criteria = new Criteria();
    private PagingToolBar toolBar;
    private ListStore<BeanObject> store;
    private Grid<BeanObject> grid;

	public static class State extends PageState {
		public String getPageClassName() {
			return FavourableActivityListPanel.class.getName();
		}
		public String getMenuDisplayName() {
			return "优惠活动";
		}
	}

	public State getCurState() {
        if (curState == null ) {
            curState = new State();
        }
        return (State)curState;
	}

    public String getDescription() {
        return "cwBasicTextDescription";
    }

    public String getName() {
        return "优惠活动列表";
    }

    public String getButtonText() {
        return "添加优惠活动 ";
    }

    protected void buttonClicked() {
    	NewFavourableActivityPanel.State state = new NewFavourableActivityPanel.State();
        state.execute();
    }

    public FavourableActivityListPanel() {
    	initJS(this);
    }

    protected void onRender(Element parent, int index) {
		super.onRender(parent, index);

		TextBox searchText = new TextBox();
		Button searchButton = new Button("搜索");
		CheckBox searchCheckBox = new CheckBox();
		Label searchLabel = new Label("仅显示进行中的活动");

		HorizontalPanel header = new HorizontalPanel();
		header.add(Resources.images.icon_search().createImage());
		header.add(new Label("商品名称"));
		header.add(searchText);
		header.add(searchButton);
		header.add(searchCheckBox);
		header.add(searchLabel);
		add(header);

		BasePagingLoader loader = new PagingListService().getLoader(ModelNames.FAVOURABLEACTIVITY, criteria);
		loader.load(0, 10);
		store = new ListStore<BeanObject>(loader);
		toolBar = new PagingToolBar(10);
		toolBar.bind(loader);

		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		final CheckBoxSelectionModel<BeanObject> smRowSelection = new CheckBoxSelectionModel<BeanObject>();
		columns.add(smRowSelection.getColumn());
		ColumnConfig number = new ColumnConfig("number", "编号", 50);
        columns.add(number);
        columns.add(new ColumnConfig(IFavourableActivity.ACT_NAME, "优惠活动名称", 150));
        ColumnConfig startTime = new ColumnConfig(IFavourableActivity.START_TIME, "开始时间", 150);
        columns.add(startTime);
        ColumnConfig endTime = new ColumnConfig(IFavourableActivity.END_TIME, "结束时间", 150);
        columns.add(endTime);
        columns.add(new ColumnConfig(IFavourableActivity.MIN_AMOUNT, "金额下限", 100));
        columns.add(new ColumnConfig(IFavourableActivity.MAX_AMOUNT, "金额上限", 100));
        columns.add(new ColumnConfig(IFavourableActivity.SORT_ORDER, "排序", 50));
        ColumnConfig action = new ColumnConfig("", "操作", 100);
        columns.add(action);

        ColumnModel cm = new ColumnModel(columns);
        grid = new Grid<BeanObject>(store, cm);

        grid.setLoadMask(true);
        grid.setBorders(true);
        grid.setSelectionModel(smRowSelection);
        grid.addPlugin(smRowSelection);
        grid.setHeight(350);

        DateFormatActionCellRenderer myRender = new DateFormatActionCellRenderer(grid);
//        startTime.setRenderer(myRender);
//        endTime.setRenderer(myRender);

        ActionCellRenderer render = new ActionCellRenderer(grid);
		ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo();
		act.setImage("icon_edit.gif");
		act.setAction("changeFavourableActivity($id)");
		act.setTooltip("编辑");
		render.addAction(act);
		act = new ActionCellRenderer.ActionInfo();
		act.setImage("icon_trash.gif");
		act.setAction("deleteFavourableActivity($id)");
        act.setTooltip("删除");
        render.addAction(act);
        action.setRenderer(render);

        ContentPanel panel = new ContentPanel();
        panel.setFrame(true);
        panel.setCollapsible(true);
        panel.setAnimCollapse(false);
        panel.setButtonAlign(HorizontalAlignment.CENTER);
        panel.setIconStyle("icon-table");
        panel.setLayout(new FitLayout());
        panel.add(grid);
        panel.setBottomComponent(toolBar);

        contentPanel.add(panel);

        HorizontalPanel bottomPanel = new HorizontalPanel();
        Button deleteButton = new Button();
        deleteButton.setText("删除");
        bottomPanel.add(deleteButton);
//        contentPanel.createPanel(null, null, bottomPanel);

		add(contentPanel);
    }

    private native void initJS(FavourableActivityListPanel me) /*-{
    $wnd.changeFavourableActivity = function (id) {
        me.@com.jcommerce.gwt.client.panels.promote.FavourableActivityListPanel::modifyFavourableActivityAndRefrsh(Ljava/lang/String;)(id);
    };
    $wnd.deleteFavourableActivity = function (id) {
	    me.@com.jcommerce.gwt.client.panels.promote.FavourableActivityListPanel::deleteFavourableActivityAndRefrsh(Ljava/lang/String;)(id);
	};
    }-*/;

    private void modifyFavourableActivityAndRefrsh(final String id) {
        new ListService().listBeans(ModelNames.FAVOURABLEACTIVITY, new ListService.Listener() {
            public void onSuccess(List<BeanObject> beans) {
                for (Iterator<BeanObject> it = beans.iterator(); it.hasNext();) {
                    BeanObject favourableActivity = it.next();
                    if(favourableActivity.getString(IFavourableActivity.ID).trim().equals(id.trim())){
                    	ModifyFavourableActivityListPanel.State state = new ModifyFavourableActivityListPanel.State();
                    	state.setFavourableActivity(favourableActivity);
                    	state.execute();
                    }
                }
            }
        });
    }

    private void deleteFavourableActivityAndRefrsh(final String id) {
        new DeleteService().deleteBean(ModelNames.FAVOURABLEACTIVITY, id,
				new DeleteService.Listener() {
					public void onSuccess(Boolean success) {
						FavourableActivityListPanel.State state = new FavourableActivityListPanel.State();
					    state.execute();
					    refresh();
					}
				});
    }

    public void refresh() {
		toolBar.refresh();
	}

    private class DateFormatActionCellRenderer extends ActionCellRenderer {

		public DateFormatActionCellRenderer(Grid grid) {
			super(grid);
		}

		public Object render(BeanObject model, String property,
				ColumnData config, int rowIndex, int colIndex,
				ListStore<BeanObject> store, Grid<BeanObject> grid) {

//			BeanObject bean = grid.getSelectionModel().getSelectedItem();
//			String time = bean.getString(IFavourableActivity.START_TIME);
//			System.out.println(time);
			ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo();
			System.out.println(act.getText() + " - " + act.getAction());
			String tmpAct = act.getText();
//			Long time = Long.parseLong(tmpAct);
			Date date = new Date();
//			act.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
			act.setText(date + "");
			return act.getText();
		}

    }
}


text:
package com.zhang.photo.service;

import com.zhang.photo.dao.PhotoDAO;
import com.zhang.photo.dao.PhotoRepository;
import com.zhang.photo.entity.Photo;
import com.zhang.photo.util.CommonUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.io.File;
import java.util.Date;

/**
 * Created by zhangsl on 2017/4/11.
 */
@Service
public class PhotoService {

    @Resource
    private PhotoRepository photoRepository;
    @Resource
    private PhotoDAO photoDAO;

    public Photo findById(int id){
        return photoRepository.findOne(id);
    }

    @Transactional
    public void save(Photo photo){
        photoRepository.save(photo);
    }

    public void truncatePhoto(){
        photoDAO.truncatePhoto();
    }

    public String updateDatabase(String baseDir){
        long start = System.currentTimeMillis();
        truncatePhoto();
        File dir = new File(baseDir);
        File[] files = dir.listFiles();
        int count = 0;
        for (File file : files) {
            boolean isPicture = CommonUtil.isPicture(file.getName());
            if (isPicture){
                Photo photo = new Photo();
                photo.setName(file.getName());
                photo.setUpdateTime(new Date());
                save(photo);
                count++;
            }
        }
        long end = System.currentTimeMillis();
        return "共处理"+count+"个文件,耗时:"+(end-start)+"毫秒";
    }
}


text:
/*	$NetBSD: id_subwins.c,v 1.14 2009/07/22 16:57:14 roy Exp $	*/

/*
 * Copyright (c) 1981, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)id_subwins.c	8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: id_subwins.c,v 1.14 2009/07/22 16:57:14 roy Exp $");
#endif
#endif				/* not lint */

#include "curses.h"
#include "curses_private.h"

/*
 * __id_subwins --
 *	Re-sync the pointers to lines for all the subwindows.
 */
void
__id_subwins(WINDOW *orig)
{
	WINDOW *win;
	int     oy, y;

	for (win = orig->nextp; win != orig; win = win->nextp) {
		oy = win->begy - orig->begy;
		for (y = 0; y < win->maxy; y++)
			win->alines[y]->line =
			    &orig->alines[oy + y]->line[win->ch_off];
	}
}


text:
#import <Cocoa/Cocoa.h>
#import <AFCache/AFCacheLib.h>
#import "TimelineViewController.h"
#import "PanelWindowController.h"
#import "NSMPreferencesWindowController.h"
#import "MainPreferencesViewController.h"
#import "Constants.h"
#import "NewDocumentWizardController.h"

@class MyDocument;

@interface StoryTellingEditorAppDelegate : NSObject{
    NSWindow *_window;
	NSDocumentController *_documentController;
	NSObjectController *_assetEditorController;
	MyDocument *_currentDocument;
	PanelWindowController *_panelWindowController;
	NSMPreferencesWindowController *m_prefsWindowController;
	NSWindow *_splashScreen;
	NSTextField *_splashScreenVersionLabel;
	BOOL surpressOpenDocumentError;
	NewDocumentWizardController *_newDocumentWizardController;
}

@property (nonatomic, retain) IBOutlet NSWindow *window;
@property (nonatomic, assign) IBOutlet NSDocumentController *documentController;
@property (nonatomic, retain) IBOutlet NSObjectController *assetEditorController;
@property (nonatomic, retain) MyDocument *currentDocument;
@property (nonatomic, retain) IBOutlet NSWindow *splashScreen;
@property (nonatomic, retain) IBOutlet NSTextField *splashScreenVersionLabel;
@property (nonatomic, assign) BOOL surpressOpenDocumentError;
@property (nonatomic, retain) IBOutlet NewDocumentWizardController *newDocumentWizardController;

@property (nonatomic, readonly) AssetEditor *assetEditor;

- (IBAction)showPreferences:(id)sender;
- (NSString *) pathForApplicationSupportSubFolder: (NSString *) subFolder createIfNeeded: (BOOL) createIfNeeded;

- (void) mailto: (NSString *) recipients subject: (NSString *) subject body: (NSString *) body;

- (void)showNewDocumentWizard;

@end

@interface NSApplication ( StoryTellingEditorAppDelegate )
- (StoryTellingEditorAppDelegate *) storyTellingEditorDelegate;
@end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GladLive.Server.Common
{
	/// <summary>
	/// Metadata to indcate that a handler requires elevated session verification semantics.
	/// Sessions that aren't elvated should be unable to reach the handler. Implementation is left to the consumer
	/// of the libraries.
	/// </summary>
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
	public sealed class ElevatedSessionHandlingRequiredAttribute : Attribute
	{
		//We need nothing but the attribute as a metadata marker
	}
}


text:
INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 4');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 5');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 6');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 7');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 8');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 9');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 23');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 13');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 53');

INSERT INTO public.quarto(
            descricao, tipo, numero, capacidade, andar, ocupado, valor_diaria,
            nome)
    VALUES ('As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.As suítes oferecem ambientes amplos e confortáveis que proporcionam momentos de bem estar para hóspedes que procuram um apartamento
de alto padrão.',1,'QT04',2,8,FALSE,800.00,'SUÍTES PRESIDENTE 93');


text:
package com.google.code.morphia;

import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.Set;

import com.google.code.morphia.annotations.Embedded;
import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.mapping.MappedClass;
import com.google.code.morphia.mapping.Mapper;
import com.google.code.morphia.mapping.MappingException;
import com.google.code.morphia.mapping.cache.EntityCache;
import com.google.code.morphia.utils.ReflectionUtils;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.Mongo;

/**
 *
 * @author Olafur Gauti Gudmundsson
 * @author Scott Hernandez
 **/
@SuppressWarnings("unchecked")
public class Morphia {
	private final Mapper mapper;

	public Morphia() {
        this(Collections.EMPTY_SET);
    }

    public Morphia( Set<Class> classesToMap ) {
        this.mapper = new Mapper();
        for (Class c : classesToMap) {
            map(c);
        }
    }

    public synchronized Morphia map(Class entityClass) {
        if ( !mapper.isMapped(entityClass) ) {
            mapper.addMappedClass(entityClass);
        }
        return this;
    }

    public synchronized Morphia mapPackageFromClass(Class clazz) {
        return mapPackage(clazz.getPackage().getName(), false);
    }

    /**
     * Tries to map all classes in the package specified. Fails if one of the classes is not valid for mapping.
     *
     * @param packageName
     *            the name of the package to process
     * @return the Morphia instance
     */
    public synchronized Morphia mapPackage(String packageName) {
        return mapPackage(packageName, false);
    }

    /**
     * Tries to map all classes in the package specified.
     *
     * @param packageName
     *            the name of the package to process
     * @param ignoreInvalidClasses
     *            specifies whether to ignore classes in the package that cannot be mapped
     * @return the Morphia instance
     */
    public synchronized Morphia mapPackage(String packageName, boolean ignoreInvalidClasses) {
        try {
            for (Class c : ReflectionUtils.getClasses(packageName)) {
                try {
                    Embedded embeddedAnn = ReflectionUtils.getClassEmbeddedAnnotation(c);
                    Entity enityAnn = ReflectionUtils.getClassEntityAnnotation(c);
                    if ( enityAnn != null || embeddedAnn != null ) {
                        map(c);
                    }
                } catch (MappingException ex) {
                    if (!ignoreInvalidClasses) {
                        throw ex;
                    }
                }
            }
            return this;
        } catch (IOException ioex) {
            throw new MappingException("Could not get map classes from package " + packageName, ioex);
        } catch (ClassNotFoundException cnfex) {
            throw new MappingException("Could not get map classes from package " + packageName, cnfex);
        }
    }

    /**
     * Get a set of all classes that are mapped by this instance.
     *
     * @return all classes that are mapped by this instance
     */
    public Map<String, MappedClass> getMappedClasses() {
        return Collections.unmodifiableMap(mapper.getMappedClasses());
    }

    /**
     * Check whether a specific class is mapped by this instance.
     *
     * @param entityClass
     *            the class we want to check
     * @return true if the class is mapped, else false
     */
    public boolean isMapped(Class entityClass) {
        return mapper.isMapped(entityClass);
    }

	public <T> T fromDBObject(Class<T> entityClass, DBObject dbObject, EntityCache cache) {
        if ( !entityClass.isInterface() && !mapper.isMapped(entityClass)) {
            throw new MappingException("Trying to map to an unmapped class: " + entityClass.getName());
        }
        try {
			return (T) mapper.fromDBObject(entityClass, (BasicDBObject) dbObject, cache);
        } catch ( Exception e ) {
            throw new MappingException("Could not map entity from DBObject", e); }
    }

    public DBObject toDBObject( Object entity ) {
        try {
            return mapper.toDBObject(entity);
        } catch ( Exception e ) {
            throw new MappingException("Could not map entity to DBObject", e); }
    }

    public Mapper getMapper() { return this.mapper; }

    public Datastore createDatastore(String dbName) {
    	return createDatastore(dbName, null, null);
	}

    public Datastore createDatastore(String dbName, String user, char[] pw) {
    	try {
			return createDatastore(new Mongo(), dbName, user, pw);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
    }

    public Datastore createDatastore(Mongo mon, String dbName, String user, char[] pw) {
    	return new DatastoreImpl(this, mon, dbName, user, pw);
    }

	public Datastore createDatastore(Mongo mongo, String dbName) {
		return createDatastore(mongo, dbName, null, null);
	}
}


text:
package like

import (
	"context"
	"testing"

	"github.com/smartystreets/goconvey/convey"
)

func TestLikeWebDataCnt(t *testing.T) {
	convey.Convey("WebDataCnt", t, func(ctx convey.C) {
		var (
			c   = context.Background()
			vid = int64(0)
		)
		ctx.Convey("When everything gose positive", func(ctx convey.C) {
			_, err := d.WebDataCnt(c, vid)
			ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
				ctx.So(err, convey.ShouldBeNil)
			})
		})
	})
}

func TestLikeWebDataList(t *testing.T) {
	convey.Convey("WebDataList", t, func(ctx convey.C) {
		var (
			c      = context.Background()
			vid    = int64(36)
			offset = int(1)
			limit  = int(10)
		)
		ctx.Convey("When everything gose positive", func(ctx convey.C) {
			list, err := d.WebDataList(c, vid, offset, limit)
			ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
				ctx.So(err, convey.ShouldBeNil)
				ctx.So(list, convey.ShouldNotBeNil)
			})
		})
	})
}


text:
#include <config.h>

#include "ovsdb.h"

#include "column.h"
#include "json.h"
#include "ovsdb-error.h"
#include "ovsdb-parser.h"
#include "ovsdb-types.h"
#include "simap.h"
#include "table.h"
#include "transaction.h"

struct ovsdb_schema *
ovsdb_schema_create(const char *name, const char *version, const char *cksum)
{
    struct ovsdb_schema *schema;

    schema = xzalloc(sizeof *schema);
    schema->name = xstrdup(name);
    schema->version = xstrdup(version);
    schema->cksum = xstrdup(cksum);
    shash_init(&schema->tables);

    return schema;
}

struct ovsdb_schema *
ovsdb_schema_clone(const struct ovsdb_schema *old)
{
    struct ovsdb_schema *new;
    struct shash_node *node;

    new = ovsdb_schema_create(old->name, old->version, old->cksum);
    SHASH_FOR_EACH (node, &old->tables) {
        const struct ovsdb_table_schema *ts = node->data;

        shash_add(&new->tables, node->name, ovsdb_table_schema_clone(ts));
    }
    return new;
}

void
ovsdb_schema_destroy(struct ovsdb_schema *schema)
{
    struct shash_node *node;

    if (!schema) {
        return;
    }

    SHASH_FOR_EACH (node, &schema->tables) {
        ovsdb_table_schema_destroy(node->data);
    }
    shash_destroy(&schema->tables);
    free(schema->name);
    free(schema->version);
    free(schema->cksum);
    free(schema);
}

struct ovsdb_error *
ovsdb_schema_from_file(const char *file_name, struct ovsdb_schema **schemap)
{
    struct ovsdb_schema *schema;
    struct ovsdb_error *error;
    struct json *json;

    *schemap = NULL;
    json = json_from_file(file_name);
    if (json->type == JSON_STRING) {
        error = ovsdb_error("failed to read schema",
                           "\"%s\" could not be read as JSON (%s)",
                           file_name, json_string(json));
        json_destroy(json);
        return error;
    }

    error = ovsdb_schema_from_json(json, &schema);
    json_destroy(json);
    if (error) {
        return ovsdb_wrap_error(error,
                                "failed to parse \"%s\" as ovsdb schema",
                                file_name);
    }

    *schemap = schema;
    return NULL;
}

static struct ovsdb_error * WARN_UNUSED_RESULT
ovsdb_schema_check_ref_table(struct ovsdb_column *column,
                             const struct shash *tables,
                             const struct ovsdb_base_type *base,
                             const char *base_name)
{
    struct ovsdb_table_schema *refTable;

    if (base->type != OVSDB_TYPE_UUID || !base->u.uuid.refTableName) {
        return NULL;
    }

    refTable = shash_find_data(tables, base->u.uuid.refTableName);
    if (!refTable) {
        return ovsdb_syntax_error(NULL, NULL,
                                  "column %s %s refers to undefined table %s",
                                  column->name, base_name,
                                  base->u.uuid.refTableName);
    }

    if (ovsdb_base_type_is_strong_ref(base) && !refTable->is_root) {
        /* We cannot allow a strong reference to a non-root table to be
         * ephemeral: if it is the only reference to a row, then replaying the
         * database log from disk will cause the referenced row to be deleted,
         * even though it did exist in memory.  If there are references to that
         * row later in the log (to modify it, to delete it, or just to point
         * to it), then this will yield a transaction error. */
        column->persistent = true;
    }

    return NULL;
}

static bool
is_valid_version(const char *s)
{
    int n = -1;
    ignore(ovs_scan(s, "%*[0-9].%*[0-9].%*[0-9]%n", &n));
    return n != -1 && s[n] == '\0';
}

/* Returns the number of tables in 'schema''s root set. */
static size_t
root_set_size(const struct ovsdb_schema *schema)
{
    struct shash_node *node;
    size_t n_root = 0;

    SHASH_FOR_EACH (node, &schema->tables) {
        struct ovsdb_table_schema *table = node->data;

        n_root += table->is_root;
    }
    return n_root;
}

struct ovsdb_error *
ovsdb_schema_from_json(struct json *json, struct ovsdb_schema **schemap)
{
    struct ovsdb_schema *schema;
    const struct json *name, *tables, *version_json, *cksum;
    struct ovsdb_error *error;
    struct shash_node *node;
    struct ovsdb_parser parser;
    const char *version;

    *schemap = NULL;

    ovsdb_parser_init(&parser, json, "database schema");
    name = ovsdb_parser_member(&parser, "name", OP_ID);
    version_json = ovsdb_parser_member(&parser, "version",
                                       OP_STRING | OP_OPTIONAL);
    cksum = ovsdb_parser_member(&parser, "cksum", OP_STRING | OP_OPTIONAL);
    tables = ovsdb_parser_member(&parser, "tables", OP_OBJECT);
    error = ovsdb_parser_finish(&parser);
    if (error) {
        return error;
    }

    if (version_json) {
        version = json_string(version_json);
        if (!is_valid_version(version)) {
            return ovsdb_syntax_error(json, NULL, "schema version \"%s\" not "
                                      "in format x.y.z", version);
        }
    } else {
        /* Backward compatibility with old databases. */
        version = "";
    }

    schema = ovsdb_schema_create(json_string(name), version,
                                 cksum ? json_string(cksum) : "");
    SHASH_FOR_EACH (node, json_object(tables)) {
        struct ovsdb_table_schema *table;

        if (node->name[0] == '_') {
            error = ovsdb_syntax_error(json, NULL, "names beginning with "
                                       "\"_\" are reserved");
        } else if (!ovsdb_parser_is_id(node->name)) {
            error = ovsdb_syntax_error(json, NULL, "name must be a valid id");
        } else {
            error = ovsdb_table_schema_from_json(node->data, node->name,
                                                 &table);
        }
        if (error) {
            ovsdb_schema_destroy(schema);
            return error;
        }

        shash_add(&schema->tables, table->name, table);
    }

    /* "isRoot" was not part of the original schema definition.  Before it was
     * added, there was no support for garbage collection.  So, for backward
     * compatibility, if the root set is empty then assume that every table is
     * in the root set. */
    if (root_set_size(schema) == 0) {
        SHASH_FOR_EACH (node, &schema->tables) {
            struct ovsdb_table_schema *table = node->data;

            table->is_root = true;
        }
    }

    /* Validate that all refTables refer to the names of tables that exist.
     *
     * Also force certain columns to be persistent, as explained in
     * ovsdb_schema_check_ref_table().  This requires 'is_root' to be known, so
     * this must follow the loop updating 'is_root' above. */
    SHASH_FOR_EACH (node, &schema->tables) {
        struct ovsdb_table_schema *table = node->data;
        struct shash_node *node2;

        SHASH_FOR_EACH (node2, &table->columns) {
            struct ovsdb_column *column = node2->data;

            error = ovsdb_schema_check_ref_table(column, &schema->tables,
                                                 &column->type.key, "key");
            if (!error) {
                error = ovsdb_schema_check_ref_table(column, &schema->tables,
                                                     &column->type.value,
                                                     "value");
            }
            if (error) {
                ovsdb_schema_destroy(schema);
                return error;
            }
        }
    }

    *schemap = schema;
    return NULL;
}

struct json *
ovsdb_schema_to_json(const struct ovsdb_schema *schema)
{
    struct json *json, *tables;
    struct shash_node *node;
    bool default_is_root;

    json = json_object_create();
    json_object_put_string(json, "name", schema->name);
    if (schema->version[0]) {
        json_object_put_string(json, "version", schema->version);
    }
    if (schema->cksum[0]) {
        json_object_put_string(json, "cksum", schema->cksum);
    }

    /* "isRoot" was not part of the original schema definition.  Before it was
     * added, there was no support for garbage collection.  So, for backward
     * compatibility, if every table is in the root set then do not output
     * "isRoot" in table schemas. */
    default_is_root = root_set_size(schema) == shash_count(&schema->tables);

    tables = json_object_create();

    SHASH_FOR_EACH (node, &schema->tables) {
        struct ovsdb_table_schema *table = node->data;
        json_object_put(tables, table->name,
                        ovsdb_table_schema_to_json(table, default_is_root));
    }
    json_object_put(json, "tables", tables);

    return json;
}

/* Returns true if 'a' and 'b' specify equivalent schemas, false if they
 * differ. */
bool
ovsdb_schema_equal(const struct ovsdb_schema *a,
                   const struct ovsdb_schema *b)
{
    /* This implementation is simple, stupid, and slow, but I doubt that it
     * will ever require much maintenance. */
    struct json *ja = ovsdb_schema_to_json(a);
    struct json *jb = ovsdb_schema_to_json(b);
    bool equals = json_equal(ja, jb);
    json_destroy(ja);
    json_destroy(jb);

    return equals;
}

static void
ovsdb_set_ref_table(const struct shash *tables,
                    struct ovsdb_base_type *base)
{
    if (base->type == OVSDB_TYPE_UUID && base->u.uuid.refTableName) {
        struct ovsdb_table *table;

        table = shash_find_data(tables, base->u.uuid.refTableName);
        base->u.uuid.refTable = table;
    }
}

struct ovsdb *
ovsdb_create(struct ovsdb_schema *schema)
{
    struct shash_node *node;
    struct ovsdb *db;

    db = xmalloc(sizeof *db);
    db->schema = schema;
    list_init(&db->replicas);
    list_init(&db->triggers);
    db->run_triggers = false;

    shash_init(&db->tables);
    SHASH_FOR_EACH (node, &schema->tables) {
        struct ovsdb_table_schema *ts = node->data;
        shash_add(&db->tables, node->name, ovsdb_table_create(ts));
    }

    /* Set all the refTables. */
    SHASH_FOR_EACH (node, &schema->tables) {
        struct ovsdb_table_schema *table = node->data;
        struct shash_node *node2;

        SHASH_FOR_EACH (node2, &table->columns) {
            struct ovsdb_column *column = node2->data;

            ovsdb_set_ref_table(&db->tables, &column->type.key);
            ovsdb_set_ref_table(&db->tables, &column->type.value);
        }
    }

    return db;
}

void
ovsdb_destroy(struct ovsdb *db)
{
    if (db) {
        struct shash_node *node;

        /* Remove all the replicas. */
        while (!list_is_empty(&db->replicas)) {
            struct ovsdb_replica *r
                = CONTAINER_OF(list_pop_back(&db->replicas),
                               struct ovsdb_replica, node);
            ovsdb_remove_replica(db, r);
        }

        /* Delete all the tables.  This also deletes their schemas. */
        SHASH_FOR_EACH (node, &db->tables) {
            struct ovsdb_table *table = node->data;
            ovsdb_table_destroy(table);
        }
        shash_destroy(&db->tables);

        /* The schemas, but not the table that points to them, were deleted in
         * the previous step, so we need to clear out the table.  We can't
         * destroy the table, because ovsdb_schema_destroy() will do that. */
        shash_clear(&db->schema->tables);

        ovsdb_schema_destroy(db->schema);
        free(db);
    }
}

/* Adds some memory usage statistics for 'db' into 'usage', for use with
 * memory_report(). */
void
ovsdb_get_memory_usage(const struct ovsdb *db, struct simap *usage)
{
    const struct shash_node *node;
    unsigned int cells = 0;

    SHASH_FOR_EACH (node, &db->tables) {
        const struct ovsdb_table *table = node->data;
        unsigned int n_columns = shash_count(&table->schema->columns);
        unsigned int n_rows = hmap_count(&table->rows);

        cells += n_rows * n_columns;
    }

    simap_increase(usage, "cells", cells);
}

struct ovsdb_table *
ovsdb_get_table(const struct ovsdb *db, const char *name)
{
    return shash_find_data(&db->tables, name);
}

void
ovsdb_replica_init(struct ovsdb_replica *r,
                   const struct ovsdb_replica_class *class)
{
    r->class = class;
}

void
ovsdb_add_replica(struct ovsdb *db, struct ovsdb_replica *r)
{
    list_push_back(&db->replicas, &r->node);
}

void
ovsdb_remove_replica(struct ovsdb *db OVS_UNUSED, struct ovsdb_replica *r)
{
    list_remove(&r->node);
    (r->class->destroy)(r);
}


text:
package com.martinkampjensen.thesis.model;

import java.io.Serializable;
import java.util.List;

import com.martinkampjensen.thesis.barriers.neighborhood.Neighborhood;

/**
 * A {@link BarrierForest} consists of a number of {@link BarrierTree}s. It
 * supports different measures that can be used to classify it.
 */
public interface BarrierForest extends Serializable
{
	/**
	 * Calculates different measures that can be used to classify this object.
	 * The method should only perform calculations the first time it is called.
	 */
	void calculateMeasures();

	// TODO: Document BarrierForest measures.
	int getNumberOfLeaves();
	double getMinimumValue();
	double getMinimumBarrierValue();
	double getMaximumBarrierValue();
	double getTotalBarrierValue();
	double getTotalConnectionValue();
	Node getMinimum();
	Node getMinimumBarrier();
	Node getMaximumBarrier();

	/**
	 * Returns the number of models used to build this forest.
	 *
	 * @return the number of models.
	 */
	int modelsUsed();

	/**
	 * Returns the pruning threshold.
	 *
	 * @return the pruning threshold, or -1 if this forest was not
	 *         created using one.
	 */
	double getPruningThreshold();

	/**
	 * Returns the neighbor threshold (maximum distance between two models for
	 * them to be considered neighbors).
	 *
	 * @return the neighbor threshold, or -1 if this forest was not
	 *         created using one.
	 */
	double getNeighborThreshold();

	/**
	 * Returns the neighborhood used when constructing this forest.
	 *
	 * @return the neighborhood, or null if none was used.
	 */
	Neighborhood getNeighborhood();

	/**
	 * Returns the number of barrier trees in this forest.
	 *
	 * @return the number of barrier trees.
	 */
	int getNumberOfTrees();

	/**
	 * Returns a specific barrier tree contained in this forest.
	 *
	 * @param id id of the barrier tree.
	 * @return the barrier tree.
	 */
	BarrierTree getTree(int id);

	/**
	 * Traverses all trees in this forest and returns the node with a specific
	 * id.
	 *
	 * @param id id of the node to find.
	 * @return the node if it exists, or null.
	 */
	Node find(int id);

	/**
	 * Returns a list of models connecting the models represented by two nodes.
	 *
	 * @param fromId the starting node.
	 * @param toId the ending node.
	 * @return the models, in order, connecting the model represented by the
	 *         fromId node and the toId node.
	 * @throws IllegalArgumentException if fromId == toId or if
	 *         fromId and toId does not exist in the
	 *         same tree in this forest.
	 */
	List<Model> findConnectingModels(int fromId, int toId);
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Model</title>
<meta name="date" content="2014-04-30">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Class Model

java.lang.Object

java.lang.Thread

Model

All Implemented Interfaces:

java.lang.Runnable

public class Model
extends java.lang.Thread

Die Klasse Model ist für die I/O-Prozesse auf der Datenbasis zuständig.

Version:

1.0

Author:

Kponvi Komlan, Thomas Berblinger, Tobias Straub

Nested Class Summary

Nested classes/interfaces inherited from class java.lang.Thread

java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler

Field Summary

Fields inherited from class java.lang.Thread

MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY

Method Summary

Methods

Modifier and Type
Method and Description

void
run()

run wird direkt beim Starten des jeweiligen Threads ausgeführt.

Methods inherited from class java.lang.Thread

activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Method Detail

run

public void run()

run wird direkt beim Starten des jeweiligen Threads ausgeführt. Hierbei
 wird auf einen Integer 1, 2 oder 3 gewartet. Dabei wird kein Polling
 (busy waiting) verursacht, da readInt den Thread blockiert, bis eine
 Eingabe in der Pipe verfügbar ist. Wird 1 aufgerufen, so wird eine neue
 CSV Datei (Datenbasis) angelegt und auf Personen Objekte, welche von der
 View per Pipe gesendet werden, gewartet. Sobald ein Objekt gesendet wird,
 wird die Methode persistObject mit dem Objekt als Parameter aufgerufen.
 Der Anwendungsfall (case) 1 wird beendet sobald ein null-Objekt gesendet
 wird. Es wird dann weder auf eine weitere Anforderung in Form eines
 Integers gewartet. Wird 2 aufgerufen, so wird die Methode readCSV
 aufgerufen. Wird 3 aufgerufen, so wird die Datenbasis gelöscht. Beim
 Beschreiben der Datenbasis wird intern durch Java gepuffert. Dieser
 Puffer wird mit flush entsprechend geleert und der Inhalt sofort in die
 Datei geschrieben.

Specified by:

run in interface java.lang.Runnable

Overrides:

run in class java.lang.Thread

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?php

namespace Doctrine\DBAL\Schema\Visitor;

use Doctrine\DBAL\Platforms\AbstractPlatform,
    Doctrine\DBAL\Schema\Table,
    Doctrine\DBAL\Schema\Schema,
    Doctrine\DBAL\Schema\Column,
    Doctrine\DBAL\Schema\ForeignKeyConstraint,
    Doctrine\DBAL\Schema\Constraint,
    Doctrine\DBAL\Schema\Sequence,
    Doctrine\DBAL\Schema\Index;

class CreateSchemaSqlCollector implements Visitor
{
    /**
     * @var array
     */
    private $_createTableQueries = array();

    /**
     * @var array
     */
    private $_createSequenceQueries = array();

    /**
     * @var array
     */
    private $_createFkConstraintQueries = array();

    /**
     *
     * @var \Doctrine\DBAL\Platforms\AbstractPlatform
     */
    private $_platform = null;

    /**
     * @param AbstractPlatform $platform
     */
    public function __construct(AbstractPlatform $platform)
    {
        $this->_platform = $platform;
    }

    /**
     * @param Schema $schema
     */
    public function acceptSchema(Schema $schema)
    {

    }

    /**
     * Generate DDL Statements to create the accepted table with all its dependencies.
     *
     * @param Table $table
     */
    public function acceptTable(Table $table)
    {
        $this->_createTableQueries = array_merge($this->_createTableQueries,
            $this->_platform->getCreateTableSql($table)
        );
    }

    public function acceptColumn(Table $table, Column $column)
    {

    }

    /**
     * @param Table $localTable
     * @param ForeignKeyConstraint $fkConstraint
     */
    public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
    {
        // Append the foreign key constraints SQL
        if ($this->_platform->supportsForeignKeyConstraints()) {
            $this->_createFkConstraintQueries = array_merge($this->_createFkConstraintQueries,
                (array) $this->_platform->getCreateForeignKeySql($fkConstraint, $localTable->getName())
            );
        }
    }

    /**
     * @param Table $table
     * @param Index $index
     */
    public function acceptIndex(Table $table, Index $index)
    {

    }

    /**
     * @param Sequence $sequence
     */
    public function acceptSequence(Sequence $sequence)
    {
        $this->_createSequenceQueries = array_merge(
            $this->_createSequenceQueries, (array)$this->_platform->getCreateSequenceSql($sequence)
        );
    }

    /**
     * @return array
     */
    public function resetQueries()
    {
        $this->_createTableQueries = array();
        $this->_createSequenceQueries = array();
        $this->_createFkConstraintQueries = array();
    }

    /**
     * Get all queries collected so far.
     *
     * @return array
     */
    public function getQueries()
    {
        return array_merge(
            $this->_createTableQueries,
            $this->_createSequenceQueries,
            $this->_createFkConstraintQueries
        );
    }
}


text:
FROM java:8
ADD . /var/cats-server-src
WORKDIR /code
RUN java -jar cats-server-0.0.1-SNAPSHOT.jar


text:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <script src="/hammerhead.js" class="script-hammerhead-shadow-ui"></script>
</head>
<body>
<script type="text/javascript">
    var hammerhead = window['%hammerhead%'];

    hammerhead.start({});

    var INSTRUCTION    = hammerhead.PROCESSING_INSTRUCTIONS.dom.script;
    var getPostMessage = window[INSTRUCTION.getPostMessage];

    getPostMessage(top).call(top, '.', '.');
</script>
</body>
</html>


text:
declare module "striptags" {
    interface StripTags {
        (html: string): string;
        (html: string, allowableTags: string): string;
        (html: string, allowableTags: string[]): string;
    }
    const striptags: StripTags;
    export = striptags;
}