text stringlengths 10 2.72M |
|---|
package tm.pojo;
import org.springframework.stereotype.Component;
import java.io.Serializable;
@Component
public class Tourist implements Serializable{
private int id;
private String touristName;
private String gender;
private int age;
private String address;
private String phone;
private String company;
private String idcard;
private String info;
private String pic;
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public String getTouristName() {
return touristName;
}
public void setTouristName(String touristName) {
this.touristName = touristName;
}
}
|
package com.nisira.core.entity;
import com.nisira.annotation.ClavePrimaria;
import com.nisira.annotation.Columna;
import com.nisira.annotation.Tabla;
import com.google.gson.annotations.SerializedName;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.io.Serializable;
import java.util.Date;
import com.nisira.annotation.RelacionTabla;
import com.nisira.annotation.CampoRelacionado;
import java.util.ArrayList;
@Tabla(nombre = "DET_TAREOWEB")
@XStreamAlias("DET_TAREOWEB")
public class Det_tareoweb implements Serializable {
@ClavePrimaria
@Columna
@SerializedName("idempresa")
@XStreamAlias("IDEMPRESA")
private String idempresa = "" ;
@ClavePrimaria
@Columna
@SerializedName("idcabtareoweb")
@XStreamAlias("IDCABTAREOWEB")
private String idcabtareoweb = "" ;
@ClavePrimaria
@Columna
@SerializedName("idordenservicio")
@XStreamAlias("IDORDENSERVICIO")
private String idordenservicio = "" ;
@ClavePrimaria
@Columna
@SerializedName("iddocumento")
@XStreamAlias("IDDOCUMENTO")
private String iddocumento = "" ;
@ClavePrimaria
@Columna
@SerializedName("serie")
@XStreamAlias("SERIE")
private String serie = "" ;
@ClavePrimaria
@Columna
@SerializedName("numero")
@XStreamAlias("NUMERO")
private String numero = "" ;
@ClavePrimaria
@Columna
@SerializedName("ruc")
@XStreamAlias("RUC")
private String ruc = "" ;
@Columna
@SerializedName("razon")
@XStreamAlias("RAZON")
private String razon = "" ;
@ClavePrimaria
@Columna
@SerializedName("idcargo")
@XStreamAlias("IDCARGO")
private String idcargo = "" ;
@ClavePrimaria
@Columna
@SerializedName("idpersonal")
@XStreamAlias("IDPERSONAL")
private String idpersonal = "" ;
@ClavePrimaria
@Columna
@SerializedName("item_dordenservicio")
@XStreamAlias("ITEM_DORDENSERVICIO")
private String item_dordenservicio = "" ;
@ClavePrimaria
@Columna
@SerializedName("item2_personalservicio")
@XStreamAlias("ITEM2_PERSONALSERVICIO")
private String item2_personalservicio = "" ;
@ClavePrimaria
@Columna
@SerializedName("item_dpersonalservicio")
@XStreamAlias("ITEM_DPERSONALSERVICIO")
private String item_dpersonalservicio = "" ;
@Columna
@SerializedName("hora_req")
@XStreamAlias("HORA_REQ")
private Double hora_req = 0.00 ;
@Columna
@SerializedName("hora_llegada")
@XStreamAlias("HORA_LLEGADA")
private Double hora_llegada = 0.00 ;
@Columna
@SerializedName("hora_inicio_serv")
@XStreamAlias("HORA_INICIO_SERV")
private Double hora_inicio_serv = 0.00 ;
@Columna
@SerializedName("hora_fin_serv")
@XStreamAlias("HORA_FIN_SERV")
private Double hora_fin_serv = 0.00 ;
@Columna
@SerializedName("hora_liberacion")
@XStreamAlias("HORA_LIBERACION")
private Double hora_liberacion = 0.00 ;
@Columna
@SerializedName("fecharegistro")
@XStreamAlias("FECHAREGISTRO")
private Date fecharegistro;
@Columna
@SerializedName("fechafinregistro")
@XStreamAlias("FECHAFINREGISTRO")
private Date fechafinregistro;
@CampoRelacionado({@RelacionTabla(campo="IDEMPRESA",campoRelacionado="IDEMPRESA"), @RelacionTabla(campo="IDCABTAREOWEB",campoRelacionado="IDCABTAREOWEB")})
private Cabtareoweb cabtareoweb_fk_det_tareoweb_cabtareoweb;
/* Sets & Gets */
public void setIdempresa(String idempresa) {
this.idempresa = idempresa;
}
public String getIdempresa() {
return this.idempresa;
}
public void setIdcabtareoweb(String idcabtareoweb) {
this.idcabtareoweb = idcabtareoweb;
}
public String getIdcabtareoweb() {
return this.idcabtareoweb;
}
public void setIdordenservicio(String idordenservicio) {
this.idordenservicio = idordenservicio;
}
public String getIdordenservicio() {
return this.idordenservicio;
}
public void setIddocumento(String iddocumento) {
this.iddocumento = iddocumento;
}
public String getIddocumento() {
return this.iddocumento;
}
public void setSerie(String serie) {
this.serie = serie;
}
public String getSerie() {
return this.serie;
}
public void setNumero(String numero) {
this.numero = numero;
}
public String getNumero() {
return this.numero;
}
public void setRuc(String ruc) {
this.ruc = ruc;
}
public String getRuc() {
return this.ruc;
}
public void setRazon(String razon) {
this.razon = razon;
}
public String getRazon() {
return this.razon;
}
public void setIdcargo(String idcargo) {
this.idcargo = idcargo;
}
public String getIdcargo() {
return this.idcargo;
}
public void setIdpersonal(String idpersonal) {
this.idpersonal = idpersonal;
}
public String getIdpersonal() {
return this.idpersonal;
}
public void setItem_dordenservicio(String item_dordenservicio) {
this.item_dordenservicio = item_dordenservicio;
}
public String getItem_dordenservicio() {
return this.item_dordenservicio;
}
public void setItem2_personalservicio(String item2_personalservicio) {
this.item2_personalservicio = item2_personalservicio;
}
public String getItem2_personalservicio() {
return this.item2_personalservicio;
}
public void setItem_dpersonalservicio(String item_dpersonalservicio) {
this.item_dpersonalservicio = item_dpersonalservicio;
}
public String getItem_dpersonalservicio() {
return this.item_dpersonalservicio;
}
public void setHora_req(Double hora_req) {
this.hora_req = hora_req;
}
public Double getHora_req() {
return this.hora_req;
}
public void setHora_llegada(Double hora_llegada) {
this.hora_llegada = hora_llegada;
}
public Double getHora_llegada() {
return this.hora_llegada;
}
public void setHora_inicio_serv(Double hora_inicio_serv) {
this.hora_inicio_serv = hora_inicio_serv;
}
public Double getHora_inicio_serv() {
return this.hora_inicio_serv;
}
public void setHora_fin_serv(Double hora_fin_serv) {
this.hora_fin_serv = hora_fin_serv;
}
public Double getHora_fin_serv() {
return this.hora_fin_serv;
}
public void setHora_liberacion(Double hora_liberacion) {
this.hora_liberacion = hora_liberacion;
}
public Double getHora_liberacion() {
return this.hora_liberacion;
}
public void setFecharegistro(Date fecharegistro) {
this.fecharegistro = fecharegistro;
}
public Date getFecharegistro() {
return this.fecharegistro;
}
public void setFechafinregistro(Date fechafinregistro) {
this.fechafinregistro = fechafinregistro;
}
public Date getFechafinregistro() {
return this.fechafinregistro;
}
/* Sets & Gets FK*/
public void setCabtareoweb_fk_det_tareoweb_cabtareoweb(Cabtareoweb cabtareoweb_fk_det_tareoweb_cabtareoweb) {
this.cabtareoweb_fk_det_tareoweb_cabtareoweb = cabtareoweb_fk_det_tareoweb_cabtareoweb;
}
public Cabtareoweb getCabtareoweb_fk_det_tareoweb_cabtareoweb() {
return this.cabtareoweb_fk_det_tareoweb_cabtareoweb;
}
} |
package com.company;
public class Accesorii extends Aur {
boolean modelNou;
String tipAccesoriu;
public Accesorii(int anAparitie, boolean calitate, String nume, boolean esteScump, boolean esteRar, int gramaj, boolean ePur, boolean modelNou, String tipAccesoriu) {
super(anAparitie, calitate, nume, esteScump, esteRar, gramaj, ePur);
this.modelNou = modelNou;
this.tipAccesoriu = tipAccesoriu;
}
void showAccesorii() {
System.out.println("Este/nu este model nou: " + modelNou);
System.out.println("Tip accesoriu: " + tipAccesoriu);
}
}
|
package presentation.customer.view;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
/**
* Created by 啊 on 2016/12/7.
*/
public class ViewSearchedHotelObjects {
private StringProperty hotelName;
private StringProperty hotelLevel;
private StringProperty grades;
private StringProperty lowestPrice;
private StringProperty address;
public ViewSearchedHotelObjects(String hotelName,String hotelLevel,String grades,String lowestPrice,String address){
this.hotelName=new SimpleStringProperty(hotelName);
this.hotelLevel=new SimpleStringProperty(hotelLevel);
this.grades=new SimpleStringProperty(grades);
this.lowestPrice=new SimpleStringProperty(lowestPrice);
this.address=new SimpleStringProperty(address);
}
public StringProperty gradesProperty() {
return grades;
}
public StringProperty hotelLevelProperty() {
return hotelLevel;
}
public StringProperty hotelNameProperty() {
return hotelName;
}
public StringProperty lowestPriceProperty() {
return lowestPrice;
}
public StringProperty addressProperty() {
return address;
}
public String getHotelName() {
return hotelName.get();
}
public String getGrades() {
return grades.get();
}
public String getHotelLevel() {
return hotelLevel.get();
}
public String getLowestPrice() {
return lowestPrice.get();
}
public String getAddress() {
return address.get();
}
}
|
package com.example.canalu.model;
public class OrdersStatus {
private int idOrdersStatus;
private String ordersStatusName;
public OrdersStatus() {
}
public OrdersStatus(int idOrdersStatus, String ordersStatusName) {
this.idOrdersStatus = idOrdersStatus;
this.ordersStatusName = ordersStatusName;
}
public int getIdOrdersStatus() {
return idOrdersStatus;
}
public void setIdOrdersStatus(int idOrdersStatus) {
this.idOrdersStatus = idOrdersStatus;
}
public String getOrdersStatusName() {
return ordersStatusName;
}
public void setOrdersStatusName(String ordersStatusName) {
this.ordersStatusName = ordersStatusName;
}
@Override
public String toString() {
return "OrdersStatus{" +
"idOrdersStatus=" + idOrdersStatus +
", ordersStatusName='" + ordersStatusName + '\'' +
'}';
}
}
|
package com.explore.controller;
import com.explore.common.ServerResponse;
import com.explore.pojo.Conf;
import com.explore.service.IConfService;
import com.explore.vo.ConfVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author PinTeh
* @date 2019/5/25
*/
@RestController
@RequestMapping("/conf")
public class ConfController {
@Autowired
private IConfService confService;
@GetMapping("/sources")
public ServerResponse sources(){
return confService.sources();
}
@GetMapping("/emp")
public ServerResponse emp(){
return confService.emp();
}
@PostMapping("/")
public ServerResponse save(@RequestBody Conf conf){
return confService.save(conf);
}
@PutMapping("/")
public ServerResponse update(@RequestBody Conf conf){
return confService.update(conf);
}
@PutMapping("/update")
public ServerResponse updateByCodeAndCampusId(@RequestBody ConfVo confVo){
return confService.updateByCodeAndCampusId(confVo);
}
@DeleteMapping("/{id}")
public ServerResponse delete(@PathVariable("id")Integer id){
return confService.delete(id);
}
}
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package eit.searchengine.core;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
*
* @author swop
*/
public class InfosDocument implements Serializable {
private static int _cptInstances = 0;
private int id;
private String url;
private String title;
private String urlLocal;
private ArrayList<String> liensVersAutresDocs;
private ArrayList<String> liensPointantVersCeDoc;
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setUrlLocal(String urlLocal) {
this.urlLocal = urlLocal;
}
public String getUrlLocal() {
return urlLocal;
}
public void addLiensVersAutresDocs(String lien) {
liensVersAutresDocs.add(lien);
}
public static int getNewId() {
_cptInstances++;
return _cptInstances;
}
public InfosDocument(String urlLocal) {
this.liensVersAutresDocs = new ArrayList<String>();
this.liensPointantVersCeDoc = new ArrayList<String>();
this.id = getNewId();
this.urlLocal = urlLocal;
}
//public void addLienVersAutreDoc(String url);
public int getId() {
return id;
}
public void setUrl(String url){
this.url= url;
}
public String getUrl(){
return url;
}
}
|
package edu.uiowa.icts.spring;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/test-application-context.xml"})
@TransactionConfiguration(transactionManager="transactionManager")
@Transactional
public abstract class AbstractSpringTestCase extends AbstractBaseTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
}
|
package com.donkeymonkey.recyq.activities;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Build;
import android.support.design.widget.TabItem;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.donkeymonkey.recyq.R;
import com.donkeymonkey.recyq.dialogs.DialogPartners;
import com.donkeymonkey.recyq.dialogs.DialogProfile;
import com.donkeymonkey.recyq.fragments.CommunityFragment;
import com.donkeymonkey.recyq.fragments.LocationsFragment;
import com.donkeymonkey.recyq.fragments.StoreFragment;
import com.donkeymonkey.recyq.fragments.SocialFragment;
import com.donkeymonkey.recyq.fragments.StatsFragment;
import com.donkeymonkey.recyq.model.Coupon;
import com.donkeymonkey.recyq.model.Coupons;
import com.donkeymonkey.recyq.model.RecyQLocation;
import com.donkeymonkey.recyq.model.RecyQLocations;
import com.donkeymonkey.recyq.model.StoreItem;
import com.donkeymonkey.recyq.model.StoreItems;
import com.donkeymonkey.recyq.model.User;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import net.hockeyapp.android.CrashManager;
import net.hockeyapp.android.UpdateManager;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity implements DialogInterface.OnDismissListener {
private static final String DIALOG_PROFILE= "dialog_profile";
private User mUser;
private Toolbar toolbar;
private TabLayout tabLayout;
private ViewPager viewPager;
private int[] tabIcons = {
R.drawable.stats_icon,
R.drawable.community_icon,
R.drawable.store_icon,
R.drawable.location_icon,
R.drawable.home_icon
};
private TabItem mProfileTab;
private List<ImageView> mIconList = new ArrayList<>();
private List<TextView> mTitleList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set up view
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setTitle("");
}
viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
changeIconColor(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
mProfileTab = (TabItem) findViewById(R.id.action_profile);
setupTabIcons();
mProfileTab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
android.app.FragmentManager fragmentManager = getFragmentManager();
DialogProfile dialogProfile = new DialogProfile();
dialogProfile.show(fragmentManager, DIALOG_PROFILE);
}
});
checkForUpdates();
}
public void changeIconColor(int position) {
for (int j = 0; j < mIconList.size(); j++) {
if (j == position) {
mIconList.get(j).setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.colorGreen), PorterDuff.Mode.SRC_IN);
mTitleList.get(j).setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorGreen));
} else {
mIconList.get(j).setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.colorGrey), PorterDuff.Mode.SRC_IN);
mTitleList.get(j).setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.colorGrey));
}
}
}
@Override
public void onResume() {
super.onResume();
// ... your own onResume implementation
checkForCrashes();
}
@Override
public void onPause() {
super.onPause();
unregisterManagers();
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterManagers();
}
private void checkForCrashes() {
CrashManager.register(this);
}
private void checkForUpdates() {
// Remove this for store builds!
UpdateManager.register(this);
}
private void unregisterManagers() {
UpdateManager.unregister();
}
// MARK - TAB BAR METHODS
private void setupViewPager(ViewPager viewPager) {
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
adapter.addFragment(new StatsFragment(), "Stats");
adapter.addFragment(new CommunityFragment(), "Community");
adapter.addFragment(new StoreFragment(), "Shop");
adapter.addFragment(new LocationsFragment(), "Locations");
adapter.addFragment(new SocialFragment(), "Social");
viewPager.setAdapter(adapter);
}
private void setupTabIcons() {
Float fontSize = 11f;
View headerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE))
.inflate(R.layout.custom_tab, null, false);
LinearLayout tabStats = (LinearLayout) headerView.findViewById(R.id.tab_stats);
LinearLayout tabCommunity = (LinearLayout) headerView.findViewById(R.id.tab_community);
LinearLayout tabShop = (LinearLayout) headerView.findViewById(R.id.tab_shop);
LinearLayout tabLocations = (LinearLayout) headerView.findViewById(R.id.tab_locations);
LinearLayout tabSocial = (LinearLayout) headerView.findViewById(R.id.tab_social);
ImageView iconStats = (ImageView) tabStats.findViewById(R.id.tab_stats_icon);
ImageView iconCommunity = (ImageView) tabCommunity.findViewById(R.id.tab_community_icon);
ImageView iconShop = (ImageView) tabShop.findViewById(R.id.tab_shop_icon);
ImageView iconLocations = (ImageView) tabLocations.findViewById(R.id.tab_locations_icon);
ImageView iconSocial = (ImageView) tabSocial.findViewById(R.id.tab_social_icon);
TextView titleStats = (TextView) tabStats.findViewById(R.id.tab_stats_title);
TextView titleCommunity = (TextView) tabCommunity.findViewById(R.id.tab_community_title);
TextView titleShop = (TextView) tabShop.findViewById(R.id.tab_shop_title);
TextView titleLocations = (TextView) tabLocations.findViewById(R.id.tab_locations_title);
TextView titleSocial = (TextView) tabSocial.findViewById(R.id.tab_social_title);
mIconList.add(iconStats);
mIconList.add(iconCommunity);
mIconList.add(iconShop);
mIconList.add(iconLocations);
mIconList.add(iconSocial);
mTitleList.add(titleStats);
mTitleList.add(titleCommunity);
mTitleList.add(titleShop);
mTitleList.add(titleLocations);
mTitleList.add(titleSocial);
tabLayout.getTabAt(0).setCustomView(tabStats);
tabLayout.getTabAt(1).setCustomView(tabCommunity);
tabLayout.getTabAt(2).setCustomView(tabShop);
tabLayout.getTabAt(3).setCustomView(tabLocations);
tabLayout.getTabAt(4).setCustomView(tabSocial);
}
@Override
public void onDismiss(DialogInterface dialogInterface) {
mUser = User.getInstance();
FirebaseAuth mAuth;
mAuth = FirebaseAuth.getInstance();
if (mUser.isLoggingOut()) {
mAuth.signOut();
mUser = User.getInstance();
mUser.clearUser();
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(intent);
finish();
}
}
class ViewPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public ViewPagerAdapter(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.davivienda.sara.bean.page.administracion;
import com.davivienda.sara.base.ComponenteAjaxObjectContextWeb;
import com.davivienda.sara.base.exception.EntityServicioExcepcion;
import com.davivienda.sara.bean.BaseBean;
import com.davivienda.sara.constantes.CodigoError;
import com.davivienda.sara.dto.ZonaDTO;
import com.davivienda.sara.entitys.Zona;
import com.davivienda.sara.tablas.zona.session.ZonaSessionLocal;
import com.davivienda.utilidades.conversion.JSon;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.EJBException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;
import com.davivienda.sara.tablas.usuarioaplicacion.session.UsuarioAplicacionSessionLocal;
import com.davivienda.utilidades.Constantes;
import java.util.logging.Level;
/**
*
* @author jmcastel
*/
@ManagedBean(name = "zonaBean")
@ViewScoped
public class zonaBean extends BaseBean implements Serializable {
@EJB
ZonaSessionLocal zonaSession;
@EJB
UsuarioAplicacionSessionLocal usuarioAplicacionSession;
private String codigo;
private String nombre;
private boolean primeraVez;
private String descripcion;
private int cantidadZona;
private boolean mostrarBtnGrabar;
private String usuarioSeleccionado;
private boolean mostrarBtnCancelar;
private List<SelectItem> listaZona;
public ComponenteAjaxObjectContextWeb objectContext;
@PostConstruct
public void ZonaBean() {
String error = "";
try {
objectContext = cargarComponenteAjaxObjectContext();
setListaZona(new ArrayList<SelectItem>());
if (objectContext != null) {
Collection<Zona> items = zonaSession.getTodos();
this.listaZona = cargarListaZona(objectContext.getZonaCB(items));
this.setUsuarioSeleccionado("");
this.setPrimeraVez(true);
usuarioInicial();
this.cantidadZona = this.getListaZona().size();
}
} catch (Exception ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_ERROR_INTERNO, null);
}
}
public void usuarioInicial() {
System.err.println("ZonaBean-usuarioInicial: Inicio");
if (!this.listaZona.isEmpty()) {
this.codigo = String.valueOf(this.listaZona.get(1).getValue());
String nombre = this.listaZona.get(1).getLabel().split("-")[1];
this.nombre = nombre.trim();
this.descripcion = nombre.trim();
}
this.mostrarBtnGrabar = false;
this.mostrarBtnCancelar = false;
System.err.println("ZonaBean-usuarioInicial: Final");
}
public void nuevoUsuario() {
this.codigo = "";
this.nombre = "";
this.descripcion = "";
this.setMostrarBtnCancelar(true);
this.setMostrarBtnGrabar(true);
}
public void modificarUsuario() {
this.mostrarBtnCancelar = true;
this.mostrarBtnGrabar = true;
}
public void grabarUsuario() {
try {
Zona registroEntity = cargarZonaAplicacion();
if (registroEntity == null) {
abrirModal("SARA", "Los campos Código,Nombre y Descripción son obligatorios", null);
} else {
zonaSession.actualizar(registroEntity);
Collection<Zona> items = zonaSession.getTodos();
setListaZona(cargarListaZona(objectContext.getZonaCB(items)));
this.setCantidadZona(getListaZona().size());
this.mostrarBtnCancelar = false;
this.mostrarBtnGrabar = false;
abrirModal("SARA", "Se ha guardado exitosamente el registro", null);
}
} catch (java.lang.ArrayIndexOutOfBoundsException ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", "Ha llegado al último registro", null);
} catch (EJBException | EntityServicioExcepcion ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_QUERY_ERROR, null);
} catch (Exception ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_ERROR_INTERNO, null);
}
}
public void buscarRegistro() {
String error = "";
String user = "";
try {
if (!this.usuarioSeleccionado.equals("")) {
user = obtenerUsuario("BUSCAR");
Zona registroEntity = new Zona(Integer.parseInt(user.split("-")[0].trim()));
registroEntity = zonaSession.buscar(registroEntity.getIdZona());
usuarioConvert(objectContext.getZonaDTO(registroEntity));
}
if (this.primeraVez) {
this.usuarioSeleccionado = "0";
this.primeraVez = false;
}
} catch (java.lang.ArrayIndexOutOfBoundsException ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", "Ha llegado al último registro", null);
} catch (EJBException | EntityServicioExcepcion ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_QUERY_ERROR, null);
} catch (Exception ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_ERROR_INTERNO, null);
}
}
public void usuarioConvert(ZonaDTO registroEntity) {
this.codigo = String.valueOf(registroEntity.getIdZona());
this.nombre = registroEntity.getZona();
this.descripcion = registroEntity.getDescripcionZona();
this.setMostrarBtnGrabar(false);
this.setMostrarBtnCancelar(false);
}
public void borrarUsuario() {
String resp = "";
try {
Zona registroEntity = cargarZonaAplicacion();
if (registroEntity == null) {
abrirModal("SARA", "Los campos Código,Nombre y Descripción son obligatorios", null);
return;
} else {
zonaSession.borrar(registroEntity);
Collection<Zona> items = zonaSession.getTodos();
setListaZona(cargarListaZona(objectContext.getZonaCB(items)));
usuarioInicial();
abrirModal("SARA", "Se ha borrado exitosamente el registro", null);
}
} catch (java.lang.ArrayIndexOutOfBoundsException ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", "Ha llegado al último registro", null);
} catch (EJBException | EntityServicioExcepcion ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_QUERY_ERROR, null);
} catch (Exception ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_ERROR_INTERNO, null);
}
this.mostrarBtnCancelar = false;
this.mostrarBtnGrabar = false;
}
public void anteriorUsuario() {
String error = "";
String user = "";
try {
user = obtenerUsuario("ANTERIOR");
if (!user.isEmpty()) {
Zona registroEntity = new Zona(Integer.parseInt(user.split("-")[0].trim()));
registroEntity = zonaSession.buscar(registroEntity.getIdZona());
usuarioConvert(objectContext.getZonaDTO(registroEntity));
}
} catch (java.lang.ArrayIndexOutOfBoundsException ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", "Ha llegado al último registro", null);
} catch (EJBException | EntityServicioExcepcion ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_QUERY_ERROR, null);
} catch (Exception ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_ERROR_INTERNO, null);
}
}
public void siguienteUsuario() {
String error = "";
String user = "";
try {
user = obtenerUsuario("SIGUIENTE");
if (!user.isEmpty()) {
Zona registroEntity = new Zona(Integer.parseInt(user.split("-")[0].trim()));
registroEntity = zonaSession.buscar(registroEntity.getIdZona());
usuarioConvert(objectContext.getZonaDTO(registroEntity));
}
} catch (java.lang.ArrayIndexOutOfBoundsException ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", "Ha llegado al último registro", null);
} catch (EJBException | EntityServicioExcepcion ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_QUERY_ERROR, null);
} catch (Exception ex) {
objectContext.getConfigApp().loggerApp.log(Level.SEVERE, ex.getMessage(), ex);
abrirModal("SARA", Constantes.MSJ_ERROR_INTERNO, null);
}
}
public int buscarCodUsuario(String nombreUsuario) {
int codUsuario = 0;
for (SelectItem regional : this.listaZona) {
if (nombreUsuario.equalsIgnoreCase(regional.getLabel())) {
codUsuario = Integer.parseInt(String.valueOf(regional.getValue()));
}
}
return codUsuario;
}
public String obtenerUsuario(String operUsuario) {
String idUsuario = "1";
String user = "";
switch (operUsuario) {
case "BUSCAR":
idUsuario = this.getUsuarioSeleccionado();
for (SelectItem lista : getListaZona()) {
if (String.valueOf(lista.getValue()).equals(idUsuario)) {
user = lista.getLabel();
this.setUsuarioSeleccionado(idUsuario);
break;
}
}
break;
case "ANTERIOR": {
int cUser = Integer.parseInt(this.getUsuarioSeleccionado());
cUser = (cUser - 1);
if (cUser >= 1) {
idUsuario = String.valueOf(cUser);
for (SelectItem lista : getListaZona()) {
if (String.valueOf(lista.getValue()).equals(idUsuario)) {
user = lista.getLabel();
this.setUsuarioSeleccionado(idUsuario);
break;
}
}
}
break;
}
case "SIGUIENTE": {
int cUser = Integer.parseInt(this.getUsuarioSeleccionado());
cUser = (cUser + 1);
if (cUser <= this.getCantidadZona()) {
idUsuario = String.valueOf(cUser);
for (SelectItem lista : getListaZona()) {
if (String.valueOf(lista.getValue()).equals(idUsuario)) {
user = lista.getLabel();
this.setUsuarioSeleccionado(idUsuario);
break;
}
}
}
break;
}
default:
break;
}
return user;
}
private List<SelectItem> cargarListaZona(List<ZonaDTO> zonaCB) {
List<SelectItem> lista = new ArrayList<SelectItem>();
SelectItem item = new SelectItem(0, "");
lista.add(item);
int cont = 1;
for (ZonaDTO dto : zonaCB) {
item = new SelectItem(cont, dto.getIdZona() + " - " + dto.getZona());
lista.add(item);
cont++;
}
return lista;
}
public Zona cargarZonaAplicacion() {
Zona tc = new Zona();
Integer intTmp = null;
String strTmp = "";
intTmp = Integer.parseInt(this.codigo);
if (intTmp == null) {
return null;
}
tc.setIdZona(intTmp);
strTmp = this.descripcion;
if (strTmp.length() == 0) {
return null;
}
tc.setDescripcionZona(strTmp);
strTmp = this.nombre;
if (strTmp.length() == 0) {
return null;
}
tc.setZona(strTmp);
return tc;
}
/**
* @return the codigo
*/
public String getCodigo() {
return codigo;
}
/**
* @param codigo the codigo to set
*/
public void setCodigo(String codigo) {
this.codigo = codigo;
}
/**
* @return the nombre
*/
public String getNombre() {
return nombre;
}
/**
* @param nombre the nombre to set
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* @return the descripcion
*/
public String getDescripcion() {
return descripcion;
}
/**
* @param descripcion the descripcion to set
*/
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
/**
* @return the primeraVez
*/
public boolean isPrimeraVez() {
return primeraVez;
}
/**
* @param primeraVez the primeraVez to set
*/
public void setPrimeraVez(boolean primeraVez) {
this.primeraVez = primeraVez;
}
/**
* @return the cantidadZona
*/
public int getCantidadZona() {
return cantidadZona;
}
/**
* @param cantidadZona the cantidadZona to set
*/
public void setCantidadZona(int cantidadZona) {
this.cantidadZona = cantidadZona;
}
/**
* @return the mostrarBtnGrabar
*/
public boolean isMostrarBtnGrabar() {
return mostrarBtnGrabar;
}
/**
* @param mostrarBtnGrabar the mostrarBtnGrabar to set
*/
public void setMostrarBtnGrabar(boolean mostrarBtnGrabar) {
this.mostrarBtnGrabar = mostrarBtnGrabar;
}
/**
* @return the usuarioSeleccionado
*/
public String getUsuarioSeleccionado() {
return usuarioSeleccionado;
}
/**
* @param usuarioSeleccionado the usuarioSeleccionado to set
*/
public void setUsuarioSeleccionado(String usuarioSeleccionado) {
this.usuarioSeleccionado = usuarioSeleccionado;
}
/**
* @return the mostrarBtnCancelar
*/
public boolean isMostrarBtnCancelar() {
return mostrarBtnCancelar;
}
/**
* @param mostrarBtnCancelar the mostrarBtnCancelar to set
*/
public void setMostrarBtnCancelar(boolean mostrarBtnCancelar) {
this.mostrarBtnCancelar = mostrarBtnCancelar;
}
/**
* @return the listaZona
*/
public List<SelectItem> getListaZona() {
return listaZona;
}
/**
* @param listaZona the listaZona to set
*/
public void setListaZona(List<SelectItem> listaZona) {
this.listaZona = listaZona;
}
}
|
package com.bignerdranch.android.photogallery;
import android.app.DownloadManager;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import java.util.List;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class PhotoGalleryFragment extends VisibleFragment {
private static final String API_KEY = "08dbe0448dd00d9d9e6887db8bab3a5d";
private static final String TAG = PhotoGalleryFragment.class.getSimpleName(); // hiermee verwijs je naar de naam van de class, wordt automatisch meegewijzigd als je de naam van de class wijzigt
private RecyclerView mPhotoRecyclerView;
public static final String BASE_URL = "https://api.flickr.com/";
private static List<GalleryItem> mGalleryItems;
private int pageNumber = 1; // challenge p.428
public static PhotoGalleryFragment newInstance() {
return new PhotoGalleryFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
setHasOptionsMenu(true);
//Intent i = PollService.newIntent(getActivity());
// getActivity().startService(i);
//PollService.setServiceAlarm(getActivity(), true);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.fragment_photo_gallery, menu);
MenuItem toggleItem = menu.findItem(R.id.menu_item_toggle_polling);
if (PollService.isServiceAlarmOn(getActivity())) {
toggleItem.setTitle(R.string.stop_polling);
} else {
toggleItem.setTitle(R.string.start_polling);
}
MenuItem searchItem = menu.findItem(R.id.menu_item_search);
final SearchView searchView = (SearchView) searchItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
Log.d(TAG, "QueryTextSubmit: " + s);
QueryPreferences.setStoredQuery(getActivity(), s);
new FlickrFetch().getText(s);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
Log.d(TAG, "QueryTextChange: " + s);
return false;
}
});
searchView.setOnSearchClickListener (new View.OnClickListener(){
@Override
public void onClick(View v) {
String query = QueryPreferences.getStoredQuery(getActivity());
searchView.setQuery(query, false);
}
});
}
//private void updateItems(){
// new FlickrFetch().getData();}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_item_clear:
QueryPreferences.setStoredQuery(getActivity(), null);
new FlickrFetch().getData();
return true;
case R.id.menu_item_toggle_polling:
boolean shouldStartAlarm = !PollService.isServiceAlarmOn(getActivity());
PollService.setServiceAlarm(getActivity(), shouldStartAlarm);
getActivity().invalidateOptionsMenu();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_photo_gallery, container, false);
mPhotoRecyclerView = (RecyclerView) v.findViewById(R.id.fragment_photo_gallery_recycler_view);
mPhotoRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3)); // 3 columns
mPhotoRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { // challenge p.428 start
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (!recyclerView.canScrollVertically(dy)) {
if (pageNumber < 10) {
pageNumber++;
new FlickrFetch().getData();
}
}
}
});
new FlickrFetch().getData();
return v;
}
public static List<GalleryItem> getGalleryItems() {
return mGalleryItems; // het is static dus je zou het kunnen renamen naar sGalleryItems.
}
public class FlickrFetch {
ApiEndpointInterface apiResponse;
public void prepareRetrofitRequest(){
//logging
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
//Create the retrofit-object
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create())
.build();
apiResponse = retrofit.create(ApiEndpointInterface.class);
}
public void getData() {
prepareRetrofitRequest();
apiResponse.getGalleryItems(API_KEY, pageNumber).enqueue(new Callback<GalleryApiResponse>() { // Challenge p.428 - add pageNumber
@Override
public void onResponse(Call<GalleryApiResponse> call, Response<GalleryApiResponse> response) {
setResponse(response);
}
@Override
public void onFailure(Call<GalleryApiResponse> call, Throwable t) {
Log.e("Retrofit error", t.getMessage());
}
});
}
private void setResponse(Response<GalleryApiResponse> response) {
GalleryApiResponse mGalleryApiResponse = response.body();
if (response.body() == null) {
Log.e("Retrofit body null", String.valueOf(response.code())); //Here, we send a message to the log that is the Retrofit returns null, this text should be in the error
}
mGalleryItems = mGalleryApiResponse.getGalleryItems();
Log.v("mGalleryItems", String.valueOf(response.body().getGalleryItems().size())); // Show this word in the verbose LogCat if there is an error.
if (mPhotoRecyclerView != null) {
mPhotoRecyclerView.setAdapter(new PhotoAdapter(mGalleryItems));
}
}
// Chapter 25
public void getText(String s) {
prepareRetrofitRequest();
apiResponse.getSearchItems(API_KEY, s).enqueue(new Callback<GalleryApiResponse>() { // Challenge p.428 - add pageNumber
@Override
public void onResponse(Call<GalleryApiResponse> call, Response<GalleryApiResponse> response) {
setResponse(response);
}
@Override
public void onFailure(Call<GalleryApiResponse> call, Throwable t) {
}
});
}
private class PhotoHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//private TextView mTitleTextView;
private ImageView mItemImageView;
private GalleryItem mGalleryItem;
public PhotoHolder(View itemView) {
super(itemView);
//mTitleTextView = (TextView) itemView;
//mItemImageView = (ImageView) itemView;
mItemImageView = (ImageView) itemView.findViewById(R.id.iv_photo_gallery_fragment);
itemView.setOnClickListener(this);
}
public void bindGalleryItem(GalleryItem item) {
mGalleryItem = item;
//mTitleTextView.setText(item.getId()); // we use the id instead of the title as two photos can have the same name.
Glide.with(getActivity())
.load(item.getUrl()) // method chaining
.placeholder(R.mipmap.ic_launcher)
.into(mItemImageView);
}
@Override
public void onClick(View v) {
//Intent i = new Intent (Intent.ACTION_VIEW, mGalleryItem.getPhotoPageUri());
Intent i = PhotoPageActivity.newIntent(getActivity(), mGalleryItem.getPhotoPageUri());
startActivity(i);
}
}
private class PhotoAdapter extends RecyclerView.Adapter<PhotoHolder> {
private List<GalleryItem> mGalleryItems;
public PhotoAdapter(List<GalleryItem> galleryItems) {
mGalleryItems = galleryItems;
}
@Override
public PhotoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//TextView textView = new TextView(getActivity());
//return new PhotoHolder(textView);
//ImageView imageView = new ImageView(getActivity());
//return new PhotoHolder(imageView);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.gallery_item, parent, false);
return new PhotoHolder(view);
}
@Override
public void onBindViewHolder(PhotoHolder holder, int position) {
GalleryItem mGalleryItem = mGalleryItems.get(position);
holder.bindGalleryItem(mGalleryItem);
}
@Override
public int getItemCount() {
return mGalleryItems.size();
}
}
}
} |
package com.role.game.dto;
import java.io.Serializable;
public class MissionMap implements Serializable {
private static final long serialVersionUID = -7038605768765213359L;
private final int x;
private final int y;
public MissionMap(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
@Override
public String toString() {
return "MissionMap [x=" + x + ", y=" + y + "]";
}
@Override
public boolean equals(Object o) {
MissionMap mission = (MissionMap) o;
return x == mission.x && y == mission.y;
}
}
|
package com.yc.education.mapper.account;
import com.yc.education.model.account.AccountSaleInvoice;
import com.yc.education.util.MyMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AccountSaleInvoiceMapper extends MyMapper<AccountSaleInvoice> {
/**
* @Description 根据客户编号查找该客户所有的销项发票
* @Author BlueSky
* @Date 16:20 2019/5/6
**/
List<AccountSaleInvoice> listAccountSaleInvoiceByCustomer(@Param("customerNo")String cusotmerNo);
/**
* @Description 根据客户编号查询未冲账发票或者未冲完的发票
* @Author BlueSky
* @Date 21:36 2019/5/5
**/
List<AccountSaleInvoice> listNotRushAccountSaleInvoice(@Param("customerNo")String customerNo);
/**
* 查询最大订单号
* @return
*/
String getMaxOrderNo();
/**
* 查询所有的 销项发票
* @return
*/
List<AccountSaleInvoice> listAccountSaleInvoice(@Param("text")String text);
/**
* 订单号模糊查询
* @param orderNo
* @return
*/
List<AccountSaleInvoice> listOrderNoLike(@Param("orderNo") String orderNo);
/**
* 根据 单号 查询 销项发票
* @param orderno 冲账编号
* @return
*/
AccountSaleInvoice getByOrderNo(@Param("orderno") String orderno);
/**
* 查询所有待审核的销项发票
* @return
*/
List<AccountSaleInvoice> listAccountSaleInvoiceNotSh();
} |
package pers.mine.scratchpad.designpattern.creational;
import cn.hutool.core.annotation.AnnotationUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ClassUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* 依赖注入
* 1.声明需要创建的对象需要哪些依赖对象
* 2.注册创建这些依赖对象所需要的类
* 3.提供一种使用1和2两点思想创建对象的机制
*/
public class DependencyInjection {
interface Action {
void some();
}
@Component("ActionA")
static class ActionImpl implements Action {
@Resource(name = "ServiceA")
IService service;
@Override
public void some() {
service.doSome();
}
}
interface IService {
void doSome();
}
@Component("ServiceA")
static class ServiceImpl implements IService {
@Override
public void doSome() {
System.out.println("do some");
}
}
static class IocContext {
Map<String, Object> beans = new HashMap<>();
void init() {
try {
//扫描所有组件类
Set<Class<?>> classes = ClassUtil.scanPackageByAnnotation("pers.mine.scratchpad.designpattern.creational", Component.class);
//分两步初始化,简单解决依赖问题
//构造bean
for (Class<?> aClass : classes) {
Component component = AnnotationUtil.getAnnotation(aClass, Component.class);
String name = component.value();
Object o = aClass.newInstance();
beans.put(name, o);
}
//注入
for (Object bean : beans.values()) {
for (Field declaredField : bean.getClass().getDeclaredFields()) {
Resource resource = declaredField.getAnnotation(Resource.class);
if (resource != null) {
String name = resource.name();
Object o = beans.get(name);
Assert.notNull(o, "{}名称bean未找到!");
declaredField.set(bean, o);
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
<T> T get(String name) {
return (T) beans.get(name);
}
}
public static void main(String[] args) {
IocContext ctx = new IocContext();
ctx.init();
Action actionA = ctx.get("ActionA");
actionA.some();
}
public static void main1(String[] args) {
IService service = new ServiceImpl();
ActionImpl action = new ActionImpl();
action.service = service;
action.some();
}
}
|
package interfaceex;
public class SmartTelevisionExample {
public static void main(String[] args) {
SmartTelevision smartTelevision = new SmartTelevision();
smartTelevision.turnOn();
smartTelevision.setVolume(100);
smartTelevision.search("www.google.com");
smartTelevision.turnOff();
System.out.println();
RemoteControl remoteControl = smartTelevision;
remoteControl.turnOn();
remoteControl.setVolume(100);
remoteControl.turnOff();
System.out.println();
Searchable searchable = smartTelevision;
searchable.search("www.gmail.com");
}
}
|
package algorithms.fundamentals.sub2_dataabs.exercises;
import edu.princeton.cs.algs4.Interval1D;
import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Chen Li on 2017/1/6.
* <p>
* 1.2.2 Write an Interval1D client that takes an int value N as command-line argument,
* reads N intervals (each defined by a pair of double values) from standard input,
* and prints all pairs that intersect.
*
* 遍历寻找相交区间
* 返回的数据结构无冗余
*/
public class SimpleIntersectedIntervals1DScanner2 implements IntersectedIntervals1DScanner {
private static final double RANGE_MIN = 0;
private static final double RANGE_MAX = 10000;
public static void main(String[] args) {
if (args.length == 0) {
StdOut.println("give a number");
return;
}
//generating
int count = Integer.parseInt(args[0]);
List<Interval1D> intervals = new ArrayList<>();
double tmp;
for (int i = 0; i < count; i++) {
double left = StdRandom.uniform(RANGE_MIN, RANGE_MAX);
double right = StdRandom.uniform(RANGE_MIN, RANGE_MAX);
if (left > right) {
tmp = left;
left = right;
right = tmp;
}
intervals.add(new Interval1D(left, right));
}
//computing
IntersectedIntervals1DScanner scanner = new SimpleIntersectedIntervals1DScanner2();
long start = System.currentTimeMillis();
List<Pair<Interval1D, List<Interval1D>>> intersectedPairs = scanner.findIntersectedIntervals(intervals);
long end = System.currentTimeMillis();
//report
long ms = end - start;
IntersectedIntervals1DScanner.reportIntersected(intersectedPairs,ms);
}
public List<Pair<Interval1D, List<Interval1D>>> findIntersectedIntervals(List<Interval1D> intervals) {
List<Pair<Interval1D, List<Interval1D>>> intersectedList = new ArrayList<>();
for (int i = 0; i < intervals.size(); i++) {
Interval1D a = intervals.get(i);
List<Interval1D> list = new ArrayList<>();
for (int j = i + 1; j < intervals.size(); j++) {
Interval1D b = intervals.get(j);
if (a.intersects(b)) {
list.add(b);
}
}
if (!list.isEmpty()) {
intersectedList.add(Pair.of(a, list));
}
}
return intersectedList;
}
}
|
package util;
public interface MapCache {
public int size();
public void clear();
public boolean put(Object key, Object value);
public Object get(Object key);
}
|
/**
* This class is generated by jOOQ
*/
package schema.tables.records;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.Record4;
import org.jooq.Row4;
import org.jooq.impl.UpdatableRecordImpl;
import schema.tables.SocialAuthNonce;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.8.4"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class SocialAuthNonceRecord extends UpdatableRecordImpl<SocialAuthNonceRecord> implements Record4<Integer, String, Integer, String> {
private static final long serialVersionUID = -1577072120;
/**
* Setter for <code>bitnami_edx.social_auth_nonce.id</code>.
*/
public void setId(Integer value) {
set(0, value);
}
/**
* Getter for <code>bitnami_edx.social_auth_nonce.id</code>.
*/
public Integer getId() {
return (Integer) get(0);
}
/**
* Setter for <code>bitnami_edx.social_auth_nonce.server_url</code>.
*/
public void setServerUrl(String value) {
set(1, value);
}
/**
* Getter for <code>bitnami_edx.social_auth_nonce.server_url</code>.
*/
public String getServerUrl() {
return (String) get(1);
}
/**
* Setter for <code>bitnami_edx.social_auth_nonce.timestamp</code>.
*/
public void setTimestamp(Integer value) {
set(2, value);
}
/**
* Getter for <code>bitnami_edx.social_auth_nonce.timestamp</code>.
*/
public Integer getTimestamp() {
return (Integer) get(2);
}
/**
* Setter for <code>bitnami_edx.social_auth_nonce.salt</code>.
*/
public void setSalt(String value) {
set(3, value);
}
/**
* Getter for <code>bitnami_edx.social_auth_nonce.salt</code>.
*/
public String getSalt() {
return (String) get(3);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public Record1<Integer> key() {
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Record4 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public Row4<Integer, String, Integer, String> fieldsRow() {
return (Row4) super.fieldsRow();
}
/**
* {@inheritDoc}
*/
@Override
public Row4<Integer, String, Integer, String> valuesRow() {
return (Row4) super.valuesRow();
}
/**
* {@inheritDoc}
*/
@Override
public Field<Integer> field1() {
return SocialAuthNonce.SOCIAL_AUTH_NONCE.ID;
}
/**
* {@inheritDoc}
*/
@Override
public Field<String> field2() {
return SocialAuthNonce.SOCIAL_AUTH_NONCE.SERVER_URL;
}
/**
* {@inheritDoc}
*/
@Override
public Field<Integer> field3() {
return SocialAuthNonce.SOCIAL_AUTH_NONCE.TIMESTAMP;
}
/**
* {@inheritDoc}
*/
@Override
public Field<String> field4() {
return SocialAuthNonce.SOCIAL_AUTH_NONCE.SALT;
}
/**
* {@inheritDoc}
*/
@Override
public Integer value1() {
return getId();
}
/**
* {@inheritDoc}
*/
@Override
public String value2() {
return getServerUrl();
}
/**
* {@inheritDoc}
*/
@Override
public Integer value3() {
return getTimestamp();
}
/**
* {@inheritDoc}
*/
@Override
public String value4() {
return getSalt();
}
/**
* {@inheritDoc}
*/
@Override
public SocialAuthNonceRecord value1(Integer value) {
setId(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SocialAuthNonceRecord value2(String value) {
setServerUrl(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SocialAuthNonceRecord value3(Integer value) {
setTimestamp(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SocialAuthNonceRecord value4(String value) {
setSalt(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SocialAuthNonceRecord values(Integer value1, String value2, Integer value3, String value4) {
value1(value1);
value2(value2);
value3(value3);
value4(value4);
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached SocialAuthNonceRecord
*/
public SocialAuthNonceRecord() {
super(SocialAuthNonce.SOCIAL_AUTH_NONCE);
}
/**
* Create a detached, initialised SocialAuthNonceRecord
*/
public SocialAuthNonceRecord(Integer id, String serverUrl, Integer timestamp, String salt) {
super(SocialAuthNonce.SOCIAL_AUTH_NONCE);
set(0, id);
set(1, serverUrl);
set(2, timestamp);
set(3, salt);
}
}
|
package com.zqs.model.product;
import com.zqs.model.base.REntity;
/**
* 产品信息
*
* @author qiushi.zhou
* @date 2017年7月20日 上午10:20:32
*/
public class ProductInfo extends REntity{
private static final long serialVersionUID = 8007425869535750311L;
/** 名称 */
private String name;
/** 价格 */
private double price;
/** 类别 {@link EProductType.java} */
private int type;
/** 状态 {@link EProductStatus.java}*/
private int status;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
|
package io.gtrain.util.verifier;
import io.gtrain.util.helper.TestRoutes;
import io.gtrain.util.verifier.base.PostRequestEndpointVerifier;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author William Gentry
*/
public class CreateProfileRequestVerifier extends PostRequestEndpointVerifier {
public CreateProfileRequestVerifier(WebTestClient webClient, String token) {
super(webClient, TestRoutes.PROFILES, token);
}
}
|
package quizapp.core;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.lang.InterruptedException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.List;
public class RemoteQuizAccess implements QuizAccess {
Quiz quiz;
private final URI endpointBaseUri;
/**
* Checks if server is running.
*
* @param endpointBaseUri takes this parameter
* @throws IOException throws exception if necessary
*/
public RemoteQuizAccess(URI endpointBaseUri) throws IOException {
// Checks if server is running
try {
HttpRequest request = HttpRequest.newBuilder(new URI("http://localhost:8080").resolve(""))
.header("Accept", "application/json").GET().build();
System.out.println(request);
final HttpResponse<String> response = HttpClient.newBuilder().build().send(request,
HttpResponse.BodyHandlers.ofString());
final String responseString = response.body();
if (!responseString.equals("OK")) {
throw new IOException("Server Not Running");
}
} catch (URISyntaxException | IOException | InterruptedException e) {
throw new IOException("Server Not Running");
}
this.endpointBaseUri = endpointBaseUri;
}
private URI quizUri(String name) {
return endpointBaseUri.resolve(uriParam(name));
}
private String uriParam(String s) {
return URLEncoder.encode(s, StandardCharsets.UTF_8);
}
/**
* Returns a quiz based in an ID.
*
* @param id the id the quiz is identified by
*/
public Quiz getQuiz(String id) {
System.out.println("remote: " + id);
try {
if (quiz == null) {
HttpRequest request = HttpRequest
.newBuilder(quizUri(id))
.header("Accept", "application/json")
.GET().build();
System.out.println(request);
try {
final HttpResponse<String> response =
HttpClient.newBuilder().build().send(request,
HttpResponse.BodyHandlers.ofString());
final String responseString = response.body();
System.out.println(responseString);
this.quiz = new Gson().fromJson(responseString, new TypeToken<Quiz>() {
}.getType());
System.out.println("Quiz: " + this.quiz);
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return this.quiz;
}
/**
* Returns a list of quizzes.
*/
public Collection<Quiz> getQuizzes() {
Collection<Quiz> quizzes = null;
try {
if (quiz == null) {
HttpRequest request = HttpRequest
.newBuilder(quizUri("quizzes"))
.header("Accept", "application/json").GET()
.build();
System.out.println(request);
try {
final HttpResponse<String> response =
HttpClient.newBuilder().build().send(request,
HttpResponse.BodyHandlers.ofString());
final String responseString = response.body();
quizzes = new Gson().fromJson(responseString, new TypeToken<List<Quiz>>() {
}.getType());
System.out.println("Quizzes: " + quizzes);
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return quizzes;
}
/**
* post quiz.
*
* @param quiz the quiz that is getting posted
*/
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
public void postQuiz(Quiz quiz) {
try {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(quiz);
System.out.println(json);
HttpRequest request = HttpRequest
.newBuilder(quizUri(quiz.getId()))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(BodyPublishers.ofString(json)).build();
System.out.println(request);
final HttpResponse<String> response =
HttpClient.newBuilder().build().send(request,
HttpResponse.BodyHandlers.ofString());
String responseString = response.body();
System.out.println(responseString);
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
}
} |
package br.com.amaro.demo.strategy;
import br.com.amaro.demo.entities.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.List;
/**
* Class responsible for returning the tag indexes
*
* @author Mariane Muniz
* @version 1.0.0
*/
@Service
@RequiredArgsConstructor
public class IndexOfTagsStrategy {
/**
* Main method responsible for retrieving the tags registered in the bank from the object's unique identifier
* and return a list with the indexes.
*
* @param tags a list of entity tags
* @return a list of tag indexes
*/
public List<Integer> getIndexOfTags(final List<Tag> tags) {
Assert.notEmpty(tags, "Tags cannot be empty");
final List<Integer> vectors = new ArrayList<>();
tags.forEach(tag -> vectors.add(tag.getId() - 1));
return vectors;
}
} |
package com.esum.framework.core.event.log;
import java.io.Serializable;
import com.esum.framework.common.util.SysConstants;
import com.esum.framework.core.event.message.Header;
import com.esum.framework.core.event.message.Payload;
public class DocumentLog implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Document sequence(1+).
*/
private long docSeqno;
/**
* sender info.
*/
private PartyInfo senderInfo = new PartyInfo();
/**
* receiver info.
*/
private PartyInfo recverInfo = new PartyInfo();
/**
* conversation ID on business process.
*/
private String conversationId;
/**
* document number.
*/
private String docNumber;
/**
* document name.
*/
private String docName;
/**
* document version.
*/
private String docVersion;
/**
* error info.
*/
private ErrorInfo errorInfo;
/**
* transform type.
*/
private String txType;
/**
* input document size.
*/
private long inDocSize = 0;
/**
* output document size.
*/
private long outDocSize = 0;
/**
* input document location.
*/
private String inDocLocation;
/**
* output document location.
*/
private String outDocLocation;
private String contentType = "application/octet-stream";
private byte[] data;
public DocumentLog(long docSeqNo, byte[] data) {
this.docSeqno = docSeqNo;
this.data = data;
}
public DocumentLog(long docSeNo, Header msgHeader, Payload payload) {
this.docSeqno = docSeNo;
this.senderInfo = new PartyInfo(msgHeader.getFromParty().getUserId(), payload.getDataInfo().getSender(), payload.getDataInfo().getDetailSender());
this.recverInfo = new PartyInfo(msgHeader.getToParty().getUserId(), payload.getDataInfo().getReceiver(), payload.getDataInfo().getDetailReceiver());
this.docName = payload.getDataInfo().getDocumentName();
this.docNumber = payload.getDataInfo().getDocumentNumber();
this.docVersion = payload.getDataInfo().getDocumentVersion();
this.data = payload.getData();
}
public boolean hasError() {
if (errorInfo == null || errorInfo.getErrorCode().equals("") || errorInfo.getErrorCode().equals("null"))
return false;
return true;
}
/**
* Returns the conversationId.
* @return String
*/
public String getConversationId()
{
return conversationId;
}
/**
* Returns the data.
* @return byte[]
*/
public byte[] getData()
{
return data;
}
/**
* Returns the docName.
* @return String
*/
public String getDocName()
{
return docName;
}
/**
* Returns the docNumber.
* @return String
*/
public String getDocNumber()
{
return docNumber;
}
/**
* Returns the docSeqno.
* @return long
*/
public long getDocSeqno()
{
return docSeqno;
}
/**
* Returns the docVersion.
* @return String
*/
public String getDocVersion()
{
return docVersion;
}
/**
* Returns the errorInfo.
* @return ErrorInfo
*/
public ErrorInfo getErrorInfo()
{
return errorInfo;
}
/**
* Returns the inDocLocation.
* @return String
*/
public String getInDocLocation()
{
return inDocLocation;
}
/**
* Returns the inDocSize.
* @return long
*/
public long getInDocSize()
{
return (data == null) ? 0 : data.length;
}
/**
* Returns the outDocLocation.
* @return String
*/
public String getOutDocLocation()
{
return outDocLocation;
}
/**
* Returns the outDocSize.
* @return long
*/
public long getOutDocSize()
{
return (data==null)?0:data.length;
}
/**
* Returns the recverInfo.
* @return TPInfo
*/
public PartyInfo getRecverInfo()
{
return recverInfo;
}
/**
* Returns the senderId.
* @return TPInfo
*/
public PartyInfo getSenderInfo()
{
return senderInfo;
}
/**
* Returns the txType.
* @return String
*/
public String getTxType()
{
return txType;
}
/**
* Sets the conversationId.
* @param conversationId The conversationId to set
*/
public void setConversationId(String conversationId)
{
this.conversationId = conversationId;
}
/**
* Sets the data.
* @param data The data to set
*/
public void setData(byte[] data)
{
this.data = data;
}
/**
* Sets the docName.
* @param docName The docName to set
*/
public void setDocName(String docName)
{
this.docName = docName;
}
/**
* Sets the docNumber.
* @param docNumber The docNumber to set
*/
public void setDocNumber(String docNumber)
{
this.docNumber = docNumber;
}
/**
* Sets the docSeqno.
* @param docSeqno The docSeqno to set
*/
public void setDocSeqno(long docSeqno)
{
this.docSeqno = docSeqno;
}
/**
* Sets the docVersion.
* @param docVersion The docVersion to set
*/
public void setDocVersion(String docVersion)
{
this.docVersion = docVersion;
}
/**
* Sets the errorInfo.
* @param errorInfo The errorInfo to set
*/
public void setErrorInfo(ErrorInfo errorInfo)
{
this.errorInfo = errorInfo;
}
/**
* Sets the inDocLocation.
* @param inDocLocation The inDocLocation to set
*/
public void setInDocLocation(String inDocLocation)
{
this.inDocLocation = inDocLocation;
}
/**
* Sets the inDocSize.
* @param inDocSize The inDocSize to set
*/
public void setInDocSize(long inDocSize)
{
this.inDocSize = inDocSize;
}
/**
* Sets the outDocLocation.
* @param outDocLocation The outDocLocation to set
*/
public void setOutDocLocation(String outDocLocation)
{
this.outDocLocation = outDocLocation;
}
/**
* Sets the outDocSize.
* @param outDocSize The outDocSize to set
*/
public void setOutDocSize(long outDocSize)
{
this.outDocSize = outDocSize;
}
/**
* Sets the recverInfo.
* @param recverInfo The recverInfo to set
*/
public void setRecverInfo(PartyInfo recverInfo)
{
this.recverInfo = recverInfo;
}
/**
* Sets the senderInfo.
* @param senderInfo The senderInfo to set
*/
public void setSenderInfo(PartyInfo senderInfo)
{
this.senderInfo = senderInfo;
}
/**
* Sets the txType.
* @param txType The txType to set
*/
public void setTxType(String txType)
{
this.txType = txType;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("\tDocumentSeqNo : "+docSeqno+SysConstants.LINE_SEPARATOR);
if (senderInfo != null)
buffer.append("\tSenderInfo : "+senderInfo.toString()+SysConstants.LINE_SEPARATOR);
if (recverInfo != null)
buffer.append("\tRecverInfo : "+recverInfo.toString()+SysConstants.LINE_SEPARATOR);
buffer.append("\tConversationId : "+conversationId+SysConstants.LINE_SEPARATOR);
buffer.append("\tDocumentNumber : "+docNumber+SysConstants.LINE_SEPARATOR);
buffer.append("\tDocumentName : "+docName+SysConstants.LINE_SEPARATOR);
buffer.append("\tDocumentVersion : "+docVersion+SysConstants.LINE_SEPARATOR);
buffer.append("\tTransformType : "+txType+SysConstants.LINE_SEPARATOR);
buffer.append("\tInDocumentSize : "+inDocSize+SysConstants.LINE_SEPARATOR);
buffer.append("\tOutDocumentSize : "+outDocSize+SysConstants.LINE_SEPARATOR);
buffer.append("\tInDocumentLocation : "+inDocLocation+SysConstants.LINE_SEPARATOR);
buffer.append("\tOutDocumentLocation : "+outDocLocation+SysConstants.LINE_SEPARATOR);
if (errorInfo != null)
buffer.append("\tErrorInfo : "+errorInfo.toString()+SysConstants.LINE_SEPARATOR);
return buffer.toString();
}
}
|
package br.com.cubo.sps.process;
import java.io.InputStream;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import br.com.cubo.sps.main.Main;
import br.com.cubo.sps.vo.Match;
import junit.framework.Assert;
public class PlayFileReaderTest {
PLayFileReader reader;
InputStream stream;
boolean exists;
boolean contains;
String className;
@Before
public void init() {
reader = new PLayFileReader();
stream = Main.class.getClassLoader().getResourceAsStream("play-test-log.log");
exists = false;
contains = true;
className = "Match";
}
@Test
public void read(){
List<Match> matchList = reader.read(stream);
Assert.assertEquals(exists, matchList.isEmpty());
Assert.assertEquals(contains, matchList.get(0).getClass().toString().contains(className));
}
}
|
import java.awt.event.*;
import java.awt.*;
//import javax.swing.*;
public class MouseListener1 extends Frame implements ActionListener,MouseListener
{
TextField t1,t2,t3;
Button b1;
Button b2;
int num1,num2,num3;
public MouseListener1()
{
setLayout(new FlowLayout());
setBackground(Color.cyan);
t1=new TextField(20);
t1.setVisible(true);
t2=new TextField(20);
t2.setVisible(true);
t3=new TextField(20);
t3.setVisible(true);
b1=new Button("Addition");
b2=new Button("Subtraction");
b1.addActionListener(this);
b2.addActionListener(this);
b1.addMouseListener(this);
add(t1);
add(t2);
add(t3);
add(b1);
add(b2);
}
public void actionPerformed(ActionEvent ae)
{
String msg=new String("Hello from JAVA...");
if(ae.getSource()==b1)
{
String result3;
num1=Integer.parseInt(t1.getText());
num2=Integer.parseInt(t2.getText());
num3=num1+num2;
result3=String.valueOf(num3);
t3.setText(result3);
}
String msg1=new String("Tata consultancy service..");
if(ae.getSource()==b2)
{
String result3;
num1=Integer.parseInt(t1.getText());
num2=Integer.parseInt(t2.getText());
num3=num1-num2;
result3=String.valueOf(num3);
t3.setText(result3);
}
}
public void mouseEntered(MouseEvent me)
{
if(me.getSource()==b1)
b1.setForeground(Color.red);
}
public void mouseClicked(MouseEvent me)
{
//if(me.getSource()==b1)
// b1.setBackground(Color.green);
}
public void mouseExited(MouseEvent me)
{
if(me.getSource()== b1)
b1.setForeground(Color.blue);
}
public void mouseReleased(MouseEvent me)
{
if(me.getSource()==b1)
b1.setBackground(Color.blue);
}
public void mousePressed(MouseEvent me)
{
if(me.getSource()==b1)
b1.setBackground(Color.cyan);
}
public static void main(String args[])
{
MouseListener1 but1=new MouseListener1();
but1.setTitle("Button Operation...");
but1.setSize(400,400);
but1.setVisible(true);
}
}
|
package com.example.myplaces;
public class MarkerModel {
private String country;
private String street;
private String zipCode;
private String markerPhotoUrl;
private String markerId;
private int markerPriority;
public MarkerModel() {
}
public MarkerModel( String markerId, String country, String street, String zipCode ) {
this.country = country;
this.street = street;
this.zipCode = zipCode;
this.markerPhotoUrl = markerPhotoUrl;
this.markerId=markerId;
this.markerPriority = markerPriority;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
public String getMarkerPhotoUrl() {
return markerPhotoUrl;
}
public void setMarkerPhotoUrl(String markerPhotoUrl) {
this.markerPhotoUrl = markerPhotoUrl;
}
public String getMarkerId() {
return markerId;
}
public void setMarkerId(String markerId) {
this.markerId = markerId;
}
public int getMarkerPriority() {
return markerPriority;
}
public void setMarkerPriority(int markerPriority) {
this.markerPriority = markerPriority;
}
}
|
package com.icanit.app_v2.provider;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.text.TextUtils;
import com.icanit.app_v2.sqlite.AppSQLite;
public class AppContentProvider extends ContentProvider {
private static final UriMatcher matcher;
private static final String ID="_id";
private AppSQLite sqlite;
public static final String AUTHORITY="com.icanit.app_v2";
private static final int TABLE = 1;
private static final int TABLE_ROW = 2;
static {
matcher = new UriMatcher(UriMatcher.NO_MATCH);
matcher.addURI(AUTHORITY, "*",TABLE);
matcher.addURI(AUTHORITY, "*/#", TABLE_ROW);
}
@Override
public boolean onCreate() {
sqlite=AppSQLite.getInstance(getContext());
return true;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
Cursor cursor = null;
SQLiteDatabase db =sqlite.getReadableDatabase();
String table=uri.getPathSegments().get(0);
switch (matcher.match(uri)) {
case TABLE:
cursor=db.query(table, projection, selection, selectionArgs,null, null, sortOrder);
break;
case TABLE_ROW:
cursor = db.query(table, projection,ID + "=" + ContentUris.parseId(uri)
+ parseSelection(selection), selectionArgs, null, null, sortOrder);
break;
default:
throw new IllegalArgumentException("uri not match any resource provide by this provider | " + uri);
}
if (cursor != null) {
cursor.setNotificationUri(getContext().getContentResolver(), uri);
}
return cursor;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
long id=-1;
SQLiteDatabase db =sqlite.getReadableDatabase();
String table=uri.getPathSegments().get(0);
switch (matcher.match(uri)) {
case TABLE:
id=db.insert(table, null, values);
break;
default:
throw new IllegalArgumentException("uri not match any resource provide by this provider | " + uri);
}
if(id>0)
getContext().getContentResolver().notifyChange(uri,null);
return ContentUris.withAppendedId(uri, id);
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
int count=0;
SQLiteDatabase db =sqlite.getReadableDatabase();
String table=uri.getPathSegments().get(0);
switch (matcher.match(uri)) {
case TABLE:
count=db.delete(table, selection, selectionArgs);
break;
case TABLE_ROW:
count = db.delete(table, ID+"="+ContentUris.parseId(uri)+parseSelection(selection), selectionArgs);
break;
default:
throw new IllegalArgumentException("uri not match any resource provide by this provider | " + uri);
}
if(count>0)
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
int count=0;
SQLiteDatabase db =sqlite.getReadableDatabase();
String table=uri.getPathSegments().get(0);
switch (matcher.match(uri)) {
case TABLE:
count=db.update(table, values, selection, selectionArgs);
break;
case TABLE_ROW:
count = db.update(table,values, ID+"="+ContentUris.parseId(uri)+parseSelection(selection), selectionArgs);
break;
default:
throw new IllegalArgumentException("uri not match any resource provide by this provider | " + uri);
}
if(count>0)
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
private String parseSelection(String selection) {
return (!TextUtils.isEmpty(selection) ? " AND (" + selection + ')' : "");
}
@Override
public String getType(Uri uri) {
return null;
}
}
|
package jp.ac.sojou.izumi.chikaken.xbee;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
/**
* @author izumi
*
*/
public class XBeeDirectSerialServer extends JFrame {
private static final long serialVersionUID = 733399969781731274L;
private CommPortIdentifier portId;
private SerialPort port;
private BufferedOutputStream xbeeBos;
private JTextField jtfPort;
private JButton jbServerOnOff;
private boolean isServerRunning = false;
private int speed = 19200;
private ServerSocket serverSocekt;
private Configuration conf;
public XBeeDirectSerialServer() {
String filename = "directserver_config.txt";
File file = new File(filename);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e1) {
e1.printStackTrace();
}
}
conf = new Configuration(file);
if (conf.getProperty("module") == null) {
conf.addProperty("module", "/dev/tty.usbserial-AH016RIU");
}
if (conf.getProperty("speed") == null) {
conf.addProperty("speed", "19200");
}
conf.store(file, "configurations");
strModule = conf.getProperty("module");
strSpeed = conf.getProperty("speed");
speed = Integer.parseInt(strSpeed.trim());
jtfPort = new JTextField(strModule);
jbServerOnOff = new JButton("Start Server [Server is Stop now]");
jbServerOnOff.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (isServerRunning) {
isServerRunning = false;
closeSerialPort();
jbServerOnOff.setText("Start Server [Server is Stop now]");
} else {
isServerRunning = true;
openSerialPort();
new Thread() {
public void run() {
startServer();
};
}.start();
jbServerOnOff
.setText("Stop Server [Server is Running now]");
}
}
});
setLayout(new BorderLayout());
add(jtfPort, BorderLayout.NORTH);
add(jbServerOnOff, BorderLayout.CENTER);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public boolean openSerialPort() {
try {
Enumeration e = CommPortIdentifier.getPortIdentifiers();
ArrayList list = Collections.list(e);
for (Object object : list) {
CommPortIdentifier cpi = (CommPortIdentifier) object;
System.out.println(cpi.getName());
}
portId = CommPortIdentifier.getPortIdentifier(jtfPort.getText());
port = (SerialPort) portId.open("Superman", 5000);
port.setSerialPortParams(speed, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
xbeeBos = new BufferedOutputStream(port.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
public boolean closeSerialPort() {
if (xbeeBos == null || port == null) {
return false;
}
try {
xbeeBos.close();
port.close();
xbeeBos = null;
port = null;
} catch (IOException e1) {
e1.printStackTrace();
}
return true;
}
byte r = 0;
private String strModule;
private String strSpeed;
public void startServer() {
while (isServerRunning) {
try {
serverSocekt = new ServerSocket(33334);
System.out.println("Waiting for connection");
final Socket s = serverSocekt.accept();
System.out.println("Connection established");
serverSocekt.close();
Thread th = new Thread() {
public void run() {
try {
byte[] buf = new byte[speed];
BufferedInputStream bis = new BufferedInputStream(
s.getInputStream(), buf.length);
BufferedOutputStream bos = new BufferedOutputStream(
s.getOutputStream(), buf.length);
while (true) {
int l = bis.read(buf);
if (l <= 0)
continue;
// System.out.println("l=" + l);
if (buf[0] == 0x65 && buf[1] == 0x6e
&& buf[2] == 0x64) {
System.out.println("End Message Received!");
break;
}
// for (byte b : buf) {
// System.out.print(" " + b);
// }
// System.out.println();
// long t = System.currentTimeMillis();
if (xbeeBos != null) {
xbeeBos.write(buf, 0, l);
xbeeBos.flush();
}
// System.out.println("t="
// + (System.currentTimeMillis() - t));
bos.write(0xFF);
bos.flush();
}
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
};
};
th.start();
} catch (IOException e) {
e.printStackTrace();
}
byte[] buf = new byte[1 + 3 * 30];
buf[0] = 0x7f;
r = (byte) ((r + 1) % 127);
for (int i = 1; i < buf.length; i += 3) {
buf[i] = (byte) (r | 0x80);
buf[i + 1] = (byte) (r | 0x80);
buf[i + 2] = (byte) (r | 0x80);
}
try {
xbeeBos.write(buf);
xbeeBos.flush();
Thread.sleep(1);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
XBeeDirectSerialServer sc = new XBeeDirectSerialServer();
sc.setBounds(100, 100, 640, 480);
sc.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
sc.setVisible(true);
}
} |
// 이범석
// 20171664
// HW8
// Inheritance
public class Circle extends Shape {
private int radius;
/*constructor*/
public Circle() {
this(30, new Point(70, 70));
}
public Circle(int r, Point pt) {
super(pt);
radius = r;
}
public Circle(Point pt) {
super(pt);
radius = 0;
}
public Circle(int r){
new Point(0,0);
}
/*toStringMethod*/
public String toString() {
return("Circle\t\t" +super.toString() +
" radius = " + getRaidus());
}
/*getMethod*/
public int getRaidus() {
return radius;
}
/*setMethod*/
public void setRaidus(int r) {
radius = r;
}
/*computeAreaMethod*/
public double computeArea() {
double r = getRaidus();
return (r * r * Math.PI);
}
}
|
package com.example.snapup_android.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Seat {
private String num_code;
private int coach_idx;
private int seat_idx;
private char seat_type;
}
|
package main;
import main.util.ThreadPool;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static java.nio.file.StandardWatchEventKinds.*;
public class FileWatcher {
private final WatchService watcher;
private final Map<WatchKey, Path> keys;
private File f;
private int stop = 0;
private ArrayList<Observer> observers = new ArrayList<>();
private ThreadPool threadPool = new ThreadPool(1); //для UI
private ThreadPool watcherPool;
/**
* Creates a WatchService and registers the given directory
*/
public FileWatcher(Path dir) throws IOException {
this.watcher = FileSystems.getDefault().newWatchService();
this.keys = new HashMap<WatchKey, Path>();
threadPool.execute(() -> {
try {
walkAndRegisterDirectories(dir);
} catch (IOException e) {
e.printStackTrace();
}
});
}
/**
* Register the given directory with the WatchService; This function will be called by FileVisitor
*/
private void registerDirectory(Path dir) throws IOException {
WatchKey key = dir.register(watcher, ENTRY_MODIFY);
keys.put(key, dir);
}
/**
* Register the given directory, and all its sub-directories, with the WatchService.
*/
private void walkAndRegisterDirectories(final Path start) throws IOException {
// register directory and sub-directories
Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
registerDirectory(dir);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException e) throws IOException {
return FileVisitResult.SKIP_SUBTREE;
}
});
if (threadPool != null) {
threadPool.shutdown();
threadPool = null;
}
}
/**
* Process all events for keys queued to the watcher
*/
private void processEvents() {
try {
while (stop == 0) {
// wait for key to be signalled
WatchKey key;
try {
key = watcher.take();
} catch (InterruptedException x) {
return;
}
Path dir = keys.get(key);
if (dir == null) {
System.err.println("WatchKey not recognized!!");
continue;
}
try {
Thread.sleep( 50 );
} catch (InterruptedException e) {
e.printStackTrace();
}
for (WatchEvent<?> event : key.pollEvents()) {
@SuppressWarnings("rawtypes")
WatchEvent.Kind kind = event.kind();
if (kind == OVERFLOW) {
continue;
}
// Context for directory entry event is the file name of entry
@SuppressWarnings("unchecked")
Path name = ((WatchEvent<Path>) event).context();
Path child = dir.resolve(name);
f = new File(child.toString());
if (f.isFile() && (stop == 0)) {
notifyAll(f);
// if directory is created, and watching recursively, then register it and its sub-directories
}
// else if (f.isDirectory() && (stop == 0)) {
// if (kind == ENTRY_CREATE) {
// try {
// if (Files.isDirectory(child)) {
// walkAndRegisterDirectories(child);
// }
// } catch (IOException x) {
// // do something useful
// }
// }
// }
}
// reset key and remove from set if directory no longer accessible
boolean valid = key.reset();
if (!valid) {
keys.remove(key);
// all directories are inaccessible
if (keys.isEmpty()) {
break;
}
}
}
} catch (Exception ignored) { }
}
public void stop() {
stop = 1;
}
public void resume() {
stop = 0;
watchOffers();
}
public void addObserver(Observer observer) {
this.observers.add(observer);
}
public void removeObserver(Observer observer) {
this.observers.remove(observer);
}
public void notifyAll(File path) {
for (Observer obs : this.observers) {
obs.update(path);
}
}
public void stopWatcher() {
watcherPool.shutdown();
watcherPool = null;
try {
this.watcher.close();
} catch (Exception ignored) { }
}
public void watchOffers() {
if (watcherPool == null) {
watcherPool = new ThreadPool(1, "Watcher_Thread");
}
watcherPool.execute(this::processEvents);
}
} |
package com.ag.payment;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import org.json.simple.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
public class ConfirmHandler implements HttpHandler{
@Override
public void handle(HttpExchange he) throws IOException{
/* /
handle the request which comes through the '/confirm' context
/*/
System.out.println("Request received");
/*/
Buffer and store the response in a string
/*/
BufferedReader br = new BufferedReader(new InputStreamReader(he.getRequestBody(), "UTF-8"));
String line = "";
StringBuilder buffer = new StringBuilder();
while((line = br.readLine()) != null)
{
buffer.append(line);
}
/*/
Once buffered, you can perform any other processing
you need on the buffered response e.g. print out the response...
/*/
System.out.println("Res: " + buffer.toString());
/*/
Prepare the response, assuming no errors have occurred. Any response
other than a 0 (zero) for the 'ResultCode' during Validation means an
error occurred and the transaction is cancelled
/*/
JSONObject obj = new JSONObject();
obj.put("ResultCode", 0);
obj.put("ResultDesc", "The service was accepted successfully");
obj.put("ThirdPartyTransID", "1234567890");
/* /
Respond to the server appropriately
/*/
String res = obj.toJSONString();
he.sendResponseHeaders(200, res.length());
OutputStream os = he.getResponseBody();
os.write(res.getBytes("UTF-8"));
os.close();
}
}
|
/*
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.handler.invocation;
import java.util.concurrent.CompletableFuture;
import reactor.core.publisher.Mono;
import org.springframework.core.MethodParameter;
import org.springframework.core.ReactiveAdapter;
import org.springframework.core.ReactiveAdapterRegistry;
/**
* Support for single-value reactive types (like {@code Mono} or {@code Single})
* as a return value type.
*
* @author Sebastien Deleuze
* @since 5.1
*/
public class ReactiveReturnValueHandler extends AbstractAsyncReturnValueHandler {
private final ReactiveAdapterRegistry adapterRegistry;
public ReactiveReturnValueHandler() {
this(ReactiveAdapterRegistry.getSharedInstance());
}
public ReactiveReturnValueHandler(ReactiveAdapterRegistry adapterRegistry) {
this.adapterRegistry = adapterRegistry;
}
@Override
public boolean supportsReturnType(MethodParameter returnType) {
return (this.adapterRegistry.getAdapter(returnType.getParameterType()) != null);
}
@Override
public boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType) {
ReactiveAdapter adapter = this.adapterRegistry.getAdapter(returnType.getParameterType(), returnValue);
return (adapter != null && !adapter.isMultiValue() && !adapter.isNoValue());
}
@Override
public CompletableFuture<?> toCompletableFuture(Object returnValue, MethodParameter returnType) {
ReactiveAdapter adapter = this.adapterRegistry.getAdapter(returnType.getParameterType(), returnValue);
if (adapter != null) {
return Mono.from(adapter.toPublisher(returnValue)).toFuture();
}
return null;
}
}
|
package com.mycompany.myapp.service.mapper;
import com.mycompany.myapp.domain.*;
import com.mycompany.myapp.service.dto.AppointmentDTO;
import org.mapstruct.*;
/**
* Mapper for the entity Appointment and its DTO AppointmentDTO.
*/
@Mapper(componentModel = "spring", uses = {PersonMapper.class, PaymentMethodMapper.class, })
public interface AppointmentMapper extends EntityMapper <AppointmentDTO, Appointment> {
@Mapping(source = "dentist.id", target = "dentistId")
@Mapping(source = "dentist.fullName", target = "dentistFullName")
@Mapping(source = "patient.id", target = "patientId")
@Mapping(source = "patient.fullName", target = "patientFullName")
@Mapping(source = "employee.id", target = "employeeId")
@Mapping(source = "employee.fullName", target = "employeeFullName")
@Mapping(source = "paymentMethod.id", target = "paymentMethodId")
@Mapping(source = "paymentMethod.name", target = "paymentMethodName")
AppointmentDTO toDto(Appointment appointment);
@Mapping(source = "dentistId", target = "dentist")
@Mapping(source = "patientId", target = "patient")
@Mapping(source = "employeeId", target = "employee")
@Mapping(source = "paymentMethodId", target = "paymentMethod")
Appointment toEntity(AppointmentDTO appointmentDTO);
default Appointment fromId(Long id) {
if (id == null) {
return null;
}
Appointment appointment = new Appointment();
appointment.setId(id);
return appointment;
}
}
|
package com.cniao5.cniaoPlay.data;
import com.cniao5.cniaoPlay.ui.activity.MainActivity;
import com.cniao5.cniaoPlay.ui.fragment.GameFragment;
import dagger.Component;
/**
* Created by mcdull.
*/
@Component(modules = ActivityModule.class)
public interface ActivityComponent {
void inject(GameFragment gameFragment);
} |
package com.me.interview;
import com.me.interview.services.TransactionsServices;
import org.jboss.logging.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class InterviewApplication {
static Logger logger = Logger.getLogger(TransactionsServices.class);
public static void main(String[] args) {
SpringApplication.run(InterviewApplication.class, args);
}
}
|
package filesprocessing;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import static filesprocessing.Errors.*;
import static filesprocessing.Filter.*;
import static filesprocessing.Order.*;
import static filesprocessing.Output.*;
/**
* class implementation of DirectoryProcessor
*/
public class DirectoryProcessor {
/** Error message of invalid number of arguments */
protected static final String ERROR_MESSAGE_NOT_2_ARGS
= "ERROR: invalid usage - didnt receive 2 arguments";
/** Error message of invalid arguments */
protected static final String ERROR_MESSAGE_INVALID_ARGS = "ERROR: invalid arguments";
/** Error message of I/O problems */
protected static final String ERROR_MESSAGE_IO_PROBLEM = "ERROR: I/O problems";
/** Error message of missing sub-section */
protected static final String ERROR_MESSAGE_MISSING_SUBSECTION_NAME = "ERROR: Missing subsection";
/** Error message of bad sub-section name or missing sub-section */
protected static final String ERROR_MESSAGE_BAD_OR_MISSING_SUBSECTION_NAME = "ERROR: Bad subsection " +
"name";
/** name of filter sub-section */
protected static final String FILTER_SECTION_NAME = "FILTER";
/** name of order sub-section */
protected static final String ORDER_SECTION_NAME = "ORDER";
/** number of the max lines distance between two sub-sections */
protected static final int MAX_LINES_BETWEEN_SUBSECTIONS = 2;
/** the separator between the filter line parts */
protected static final String SEPARATOR_IN_LINE = "#";
/** first line in a section */
protected static final int FIRST_LINE = 1;
/** second line in a section */
protected static final int SECOND_LINE = 2;
/** fourth line in a section */
protected static final int FOURTH_LINE = 4;
protected static String commandsFilePath;
protected static String sourceDirPath;
protected static File sourceDir;
protected static File commandsFile;
protected static Scanner fileScanner;
protected static ArrayList<File> filtered_files = null;
/**
* return a Scanner of the commands file
* @return Scanner of the commands file
* @throws IOException: if there was an error with accessing the file
*/
protected static Scanner getFileScanner() throws IOException {
try {
return new Scanner(commandsFile);
} catch (IOException ioe) { // I/O problems
System.err.println(ERROR_MESSAGE_IO_PROBLEM);
throw new IOException();
}
}
/**
* process the commands file to filter and order as written inside
* @param fileScanner: Scanner of the Commands file
*/
private static void processCommandsFile(Scanner fileScanner) {
int line_in_section = 1;
int line_counter = 1;
String curr_line;
boolean finished_section = false;
boolean last_was_ORDER = false;
while (fileScanner.hasNext()) { // every row
curr_line = fileScanner.nextLine();
switch (curr_line) {
case FILTER_SECTION_NAME:
if (line_in_section ==
SECOND_LINE) { // last ORDER didnt have an order-name line - sort by abs
filtered_files = filterFiles(curr_line, sourceDir, line_counter);
}
// when the section has only 3 lines so the 4th line is actually a new FILTER line
if (line_in_section == FOURTH_LINE) {
finished_section = true;
line_in_section = FIRST_LINE;
}
break;
case ORDER_SECTION_NAME:
// sort-by ABS in case that's the last row in the file and obviously has no order-name
if (line_in_section == FOURTH_LINE) {
orderFiles(curr_line, filtered_files, line_counter);
break;
}
// in case ORDER was instead of a filter-name line
if (line_in_section == SECOND_LINE) {
filtered_files = filterFiles(curr_line, sourceDir, line_counter);
break;
}
orderFiles(ABS, filtered_files, line_counter);
last_was_ORDER = true;
break;
default: // if not a title line
if (line_in_section == SECOND_LINE) { // filter-name line
filtered_files = filterFiles(curr_line, sourceDir, line_counter);
} else if (line_in_section == FOURTH_LINE) { // order-name line
orderFiles(curr_line, filtered_files, line_counter);
finished_section = true;
last_was_ORDER = false;
}
break;
}
line_in_section++;
if (finished_section) {
if (!curr_line.equals(FILTER_SECTION_NAME)) {
line_in_section = FIRST_LINE;
}
printSortedFiles(); // Print files
finished_section = false;
}
line_counter++;
}
if (last_was_ORDER) {
printSortedFiles(); // Print files
}
}
/**
* main method
* @param args: list of Strings where args[0] is sourceDir path and args[1] is Commands File path
*/
public static void main(String[] args) {
try {
if (args.length != 2) { // Type 2 error - not 2 arguments
throw new IllegalArgumentException();
}
commandsFilePath = args[1];
sourceDirPath = args[0];
sourceDir = new File(args[0]);
commandsFile = new File(commandsFilePath);
// Type 2 Errors
foundType2Error();
// Filter and Order the files
fileScanner = getFileScanner();
} catch (IllegalArgumentException exception) {
System.err.println(ERROR_MESSAGE_NOT_2_ARGS);
return;
}
// Error messages already printed in the methods
catch (RuntimeException exception) {
return;
} catch (IOException ioe) {
System.err.println(ERROR_MESSAGE_IO_PROBLEM);
return;
}
processCommandsFile(fileScanner);
fileScanner.close();
}
}
|
package behavioral.memento;
/**
* @author Renat Kaitmazov
*/
public final class Memento {
/*--------------------------------------------------------*/
/* Instance variables
/*--------------------------------------------------------*/
private final String article;
/*--------------------------------------------------------*/
/* Constructors
/*--------------------------------------------------------*/
public Memento(String article) {
this.article = article;
}
/*--------------------------------------------------------*/
/* API
/*--------------------------------------------------------*/
public final String getSavedArticle() {
return article;
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package form;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
*
* @author Bron Zilar
*/
public class Calculator extends javax.swing.JFrame {
public Calculator() {
initComponents();
setTitle("Simple calculator");
setLocationRelativeTo(null);
setListener();
}
private javax.swing.JPanel panel;
private javax.swing.JLabel lab1;
private javax.swing.JLabel lab2;
private javax.swing.JLabel lab3;
private javax.swing.JTextField txt1;
private javax.swing.JTextField txt2;
private javax.swing.JTextField txt3;
private javax.swing.JButton btnSum;
private javax.swing.JButton btnSub;
private void initComponents() {
lab1 = new javax.swing.JLabel();
lab2 = new javax.swing.JLabel();
lab3 = new javax.swing.JLabel();
txt1 = new javax.swing.JTextField();
txt2 = new javax.swing.JTextField();
txt3 = new javax.swing.JTextField();
btnSum = new javax.swing.JButton();
btnSub = new javax.swing.JButton();
panel = new javax.swing.JPanel();
panel.setBorder(javax.swing.BorderFactory.createTitledBorder("Enter values:"));
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
lab1.setText("first number:");
lab2.setText("Second number:");
lab3.setText("Result:");
txt3.setEditable(false);
btnSum.setText("Addition");
btnSub.setText("Substraction");
javax.swing.GroupLayout panelCalculationLayout = new javax.swing.GroupLayout(panel);
panel.setLayout(panelCalculationLayout);
panelCalculationLayout.setHorizontalGroup(
panelCalculationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCalculationLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelCalculationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCalculationLayout.createSequentialGroup()
.addComponent(lab1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt1, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelCalculationLayout.createSequentialGroup()
.addComponent(lab2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt2, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelCalculationLayout.createSequentialGroup()
.addComponent(lab3, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt3, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelCalculationLayout.setVerticalGroup(
panelCalculationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCalculationLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelCalculationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lab1)
.addComponent(txt1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCalculationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lab2)
.addComponent(txt2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCalculationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lab3)
.addComponent(txt3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(21, Short.MAX_VALUE))
);
btnSum.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
//sum();
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addContainerGap(277, Short.MAX_VALUE)
.addComponent(btnSum)
.addGap(18, 18, 18)
.addComponent(btnSub, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(26, 26, 26))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnSum)
.addComponent(btnSub))
.addContainerGap(23, Short.MAX_VALUE))
);
pack();
}
private void setListener() {
btnSub.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
int a = Integer.parseInt(txt1.getText().trim());
int b = Integer.parseInt(txt2.getText().trim());
txt3.setText(String.valueOf(a-b));
}
});
btnSum.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
int a = Integer.parseInt(txt1.getText().trim());
int b = Integer.parseInt(txt2.getText().trim());
txt3.setText(String.valueOf(a+b));
}
});
}
}
|
package com.example.armstest.data;
import com.example.armstest.Device;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface DeviceNameRepo extends CrudRepository<Device,Long> {
}
|
package com.app.tosstra.interfaces;
public interface RefreshMyJobs {
void refresh_jobs();
}
|
package parseararchivosxmlconsax;
import java.io.File;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import java.io.IOException;
import java.util.ArrayList;
import parseararchivosxmlconsax.Persoa;
import parseararchivosxmlconsax.PersoasXML;
public class Main
{
public static void main(String [] args)
{
XMLReader procesadorXML = null;
try {
//Creamos un parseador de texto e engadimoslle a nosa clase que vai parsear o texto
procesadorXML = XMLReaderFactory.createXMLReader();
PersoasXML persoasXML = new PersoasXML();
procesadorXML.setContentHandler(persoasXML);
//Indicamos o texto donde estan gardadas as persoas
InputSource arquivo = new InputSource(File.separator + "home" + File.separator + "manuel" + File.separator + "Documentos" + File.separator + "persoa.xml");
procesadorXML.parse(arquivo);
//Imprimimos os datos lidos no XML
ArrayList<Persoa> persoas = persoasXML.getPersoas();
for(int i=0;i<persoas.size();i++){
Persoa persoaAux = persoas.get(i);
System.out.println("Nome: " + persoaAux.getNome() + ", Idade: " + persoaAux.getIdade());
}
} catch (SAXException e) {
System.out.println("Ocurriu un erro ao ler o arquivo XML");
} catch (IOException e) {
System.out.println("Ocurriu un erro ao ler o arquivo XML");
}
}
} |
package com.paul.service;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
@Service("authorService")
public class AuthorService implements ApplicationContextAware, EnvironmentAware{
private ApplicationContext applicationContext;
private Environment environment;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public ApplicationContext getApplicationContext() {
return applicationContext;
}
public Environment getEnvironment() {
return environment;
}
public void setEnvironment(Environment environment) {
this.environment = environment;
}
public String selfIntroduction() {
return "hi, i'm AuthorService";
}
}
|
package cn.tivnan.studentls.bean.vo;
import cn.tivnan.studentls.bean.Note;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* @project: studentls
* @description: use to encapsulate unfinished note
* @author: tivnan
* @create: 2020-2020/12/2-下午12:05
* @version: 1.0
**/
public class UnFinishedNoteVO {
private Integer reqType;
private String startDate;
private String endDate;
private Integer total;
private String content;
public UnFinishedNoteVO() {
}
public UnFinishedNoteVO(Note note) {
reqType = note.getType();
startDate = note.getStartTime();
endDate = note.getEndTime();
total = getTotalDate(startDate, endDate);
content=note.getContent();
}
public Integer getReqType() {
return reqType;
}
public void setReqType(Integer reqType) {
this.reqType = reqType;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
/**
* 求出两个日期之间的间隔天数
* @param startDateStr 开始日期
* @param endDateStr 结束日期
* @return 间隔天数
*/
public Integer getTotalDate(String startDateStr, String endDateStr) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = null;
Date endDate = null;
try {
startDate = dateFormat.parse(startDateStr);
endDate = dateFormat.parse(endDateStr);
} catch (ParseException e) {
e.printStackTrace();
}
Calendar cal = Calendar.getInstance();
cal.setTime(startDate);
long time1 = cal.getTimeInMillis();
cal.setTime(endDate);
long time2 = cal.getTimeInMillis();
long between_days = (time2 - time1) / (1000 * 3600 * 24) + 1;
return Integer.parseInt(String.valueOf(between_days));
}
}
|
/* */ package br.com.sgcraft.arenax1.data;
/* */ import java.io.File;
/* */ import java.util.ArrayList;
/* */ import java.util.List;
/* */ import java.util.Set;
/* */ import java.util.logging.Level;
/* */ import org.bukkit.Bukkit;
/* */ import org.bukkit.Location;
/* */ import org.bukkit.configuration.file.FileConfiguration;
/* */ import org.bukkit.configuration.file.YamlConfiguration;
import br.com.sgcraft.arenax1.arena.Arena;
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class FlatFileData
/* */ implements Data
/* */ {
/* */ private final FileConfiguration config;
/* */ private final File arenas;
/* */
/* */ public FlatFileData(File dataFolder) {
/* 26 */ this.arenas = new File(dataFolder, "arenas.yml");
/* 27 */ this.config = (FileConfiguration)YamlConfiguration.loadConfiguration(this.arenas);
/* */ }
/* */
/* */
/* */
/* */ public void saveArena(Arena arena) {
/* 33 */ if (!arena.isCompleted()) {
/* */ return;
/* */ }
/* */
/* 37 */ this.config.set("Arenas." + arena.getName() + ".world", arena.getWorld());
/* 38 */ Location f = arena.getPos1();
/* 39 */ this.config.set("Arenas." + arena.getName() + ".pos1", Math.round(f.getX()) + " " + Math.round(f.getY()) + " " + Math.round(f.getZ()) + " " + Math.round(f.getYaw()) + " " + Math.round(f.getPitch()));
/* */
/* */
/* */
/* */
/* 44 */ f = arena.getPos2();
/* 45 */ this.config.set("Arenas." + arena.getName() + ".pos2", Math.round(f.getX()) + " " + Math.round(f.getY()) + " " + Math.round(f.getZ()) + " " + Math.round(f.getYaw()) + " " + Math.round(f.getPitch()));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void saveAllArena(List<Arena> arenas) {
/* 55 */ this.config.set("Arenas", null);
/* 56 */ for (Arena arena : arenas)
/* */ {
/* 58 */ saveArena(arena);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ public Arena loadArena(String name) {
/* 65 */ String world = this.config.getString("Arenas." + name + ".world");
/* 66 */ String[] pos1 = this.config.getString("Arenas." + name + ".pos1").split(" ");
/* 67 */ String[] pos2 = this.config.getString("Arenas." + name + ".pos2").split(" ");
/* */
/* 69 */ Location ps1 = new Location(Bukkit.getWorld(world), Double.parseDouble(pos1[0]), Double.parseDouble(pos1[1]), Double.parseDouble(pos1[2]), Float.parseFloat(pos1[3]), Float.parseFloat(pos1[4]));
/* */
/* */
/* */
/* */
/* */
/* 75 */ Location ps2 = new Location(Bukkit.getWorld(world), Double.parseDouble(pos2[0]), Double.parseDouble(pos2[1]), Double.parseDouble(pos2[2]), Float.parseFloat(pos2[3]), Float.parseFloat(pos2[4]));
/* */
/* */
/* */
/* */
/* */
/* */
/* 82 */ Arena arena = new Arena(name, world, ps1, ps2);
/* */
/* 84 */ return arena;
/* */ }
/* */
/* */
/* */
/* */ public List<Arena> loadAllArena() {
/* 90 */ List<Arena> arenas = new ArrayList<>();
/* */
/* 92 */ if (this.config.isConfigurationSection("Arenas")) {
/* */
/* 94 */ Set<String> names = this.config.getConfigurationSection("Arenas").getKeys(false);
/* */
/* 96 */ for (String string : names) {
/* */
/* */
/* */ try {
/* 100 */ arenas.add(loadArena(string));
/* 101 */ } catch (Exception e) {
/* */
/* 103 */ Bukkit.getLogger().log(Level.WARNING, "Error on load arena {0}", string);
/* */ }
/* */ }
/* */ }
/* 107 */ return arenas;
/* */ }
/* */
/* */
/* */
/* */ public void saveToBase() throws Exception {
/* 113 */ this.config.save(this.arenas);
/* */ }
/* */
/* */
/* */
/* */ public Location loadLobby() {
/* 119 */ if (this.config.contains("ArenaLobby")) {
/* */
/* 121 */ String[] lobby = this.config.getString("ArenaLobby").split(" ");
/* 122 */ return new Location(Bukkit.getWorld(lobby[5]), Double.parseDouble(lobby[0]), Double.parseDouble(lobby[1]), Double.parseDouble(lobby[2]), Float.parseFloat(lobby[3]), Float.parseFloat(lobby[4]));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* 130 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */ public void saveLobby(Location lobby) {
/* 137 */ if (lobby != null)
/* */ {
/* 139 */ this.config.set("ArenaLobby", Math.round(lobby.getX()) + " " + Math.round(lobby.getY()) + " " + Math.round(lobby.getZ()) + " " + Math.round(lobby.getYaw()) + " " + Math.round(lobby.getPitch()) + " " + lobby.getWorld().getName());
/* */ }
/* */ }
/* */ }
/* Location: C:\Users\igors\Desktop\ArenaX1-0.3.2.jar!\br\com\tinycraft\arenax1\data\FlatFileData.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/ |
package org.xtext.example.mydsl.parser.antlr.internal;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.parser.impl.*;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
import org.xtext.example.mydsl.services.MyDslGrammarAccess;
import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalMyDslParser extends AbstractInternalAntlrParser {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_NL", "RULE_COMMENT", "RULE_PLATFORM_OPTION", "RULE_SHELL_CMD", "RULE_KV_PAIR_EQUALS", "RULE_CHOWN_OPTION", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_EXEC_FORM_PARAMETER", "'FROM '", "'CMD'", "'RUN'", "'ENTRYPOINT'", "'VOLUME'", "'MAINTAINER'", "'EXPOSE'", "'WORKDIR'", "'ENV '", "'LABEL '", "'ADD '", "'?'", "'*'", "'.'", "'COPY '", "'ONBUILD '", "'/'", "':'", "'-'", "'@'", "' ['", "']'"
};
public static final int RULE_STRING=12;
public static final int T__19=19;
public static final int T__15=15;
public static final int T__16=16;
public static final int T__17=17;
public static final int T__18=18;
public static final int T__33=33;
public static final int T__34=34;
public static final int T__35=35;
public static final int T__14=14;
public static final int EOF=-1;
public static final int T__30=30;
public static final int T__31=31;
public static final int T__32=32;
public static final int RULE_SHELL_CMD=7;
public static final int RULE_ID=10;
public static final int RULE_COMMENT=5;
public static final int RULE_CHOWN_OPTION=9;
public static final int T__26=26;
public static final int T__27=27;
public static final int RULE_KV_PAIR_EQUALS=8;
public static final int T__28=28;
public static final int RULE_INT=11;
public static final int T__29=29;
public static final int T__22=22;
public static final int T__23=23;
public static final int T__24=24;
public static final int T__25=25;
public static final int RULE_NL=4;
public static final int RULE_EXEC_FORM_PARAMETER=13;
public static final int T__20=20;
public static final int RULE_PLATFORM_OPTION=6;
public static final int T__21=21;
// delegates
// delegators
public InternalMyDslParser(TokenStream input) {
this(input, new RecognizerSharedState());
}
public InternalMyDslParser(TokenStream input, RecognizerSharedState state) {
super(input, state);
}
public String[] getTokenNames() { return InternalMyDslParser.tokenNames; }
public String getGrammarFileName() { return "InternalMyDsl.g"; }
private MyDslGrammarAccess grammarAccess;
public InternalMyDslParser(TokenStream input, MyDslGrammarAccess grammarAccess) {
this(input);
this.grammarAccess = grammarAccess;
registerRules(grammarAccess.getGrammar());
}
@Override
protected String getFirstRuleName() {
return "Dockerfile";
}
@Override
protected MyDslGrammarAccess getGrammarAccess() {
return grammarAccess;
}
// $ANTLR start "entryRuleDockerfile"
// InternalMyDsl.g:64:1: entryRuleDockerfile returns [EObject current=null] : iv_ruleDockerfile= ruleDockerfile EOF ;
public final EObject entryRuleDockerfile() throws RecognitionException {
EObject current = null;
EObject iv_ruleDockerfile = null;
try {
// InternalMyDsl.g:64:51: (iv_ruleDockerfile= ruleDockerfile EOF )
// InternalMyDsl.g:65:2: iv_ruleDockerfile= ruleDockerfile EOF
{
newCompositeNode(grammarAccess.getDockerfileRule());
pushFollow(FOLLOW_1);
iv_ruleDockerfile=ruleDockerfile();
state._fsp--;
current =iv_ruleDockerfile;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleDockerfile"
// $ANTLR start "ruleDockerfile"
// InternalMyDsl.g:71:1: ruleDockerfile returns [EObject current=null] : ( ( ( (lv_statements_0_0= ruleInstruction ) ) this_NL_1= RULE_NL ) | ( ( (lv_comments_2_0= RULE_COMMENT ) ) this_NL_3= RULE_NL ) )* ;
public final EObject ruleDockerfile() throws RecognitionException {
EObject current = null;
Token this_NL_1=null;
Token lv_comments_2_0=null;
Token this_NL_3=null;
EObject lv_statements_0_0 = null;
enterRule();
try {
// InternalMyDsl.g:77:2: ( ( ( ( (lv_statements_0_0= ruleInstruction ) ) this_NL_1= RULE_NL ) | ( ( (lv_comments_2_0= RULE_COMMENT ) ) this_NL_3= RULE_NL ) )* )
// InternalMyDsl.g:78:2: ( ( ( (lv_statements_0_0= ruleInstruction ) ) this_NL_1= RULE_NL ) | ( ( (lv_comments_2_0= RULE_COMMENT ) ) this_NL_3= RULE_NL ) )*
{
// InternalMyDsl.g:78:2: ( ( ( (lv_statements_0_0= ruleInstruction ) ) this_NL_1= RULE_NL ) | ( ( (lv_comments_2_0= RULE_COMMENT ) ) this_NL_3= RULE_NL ) )*
loop1:
do {
int alt1=3;
int LA1_0 = input.LA(1);
if ( ((LA1_0>=14 && LA1_0<=24)||(LA1_0>=28 && LA1_0<=29)) ) {
alt1=1;
}
else if ( (LA1_0==RULE_COMMENT) ) {
alt1=2;
}
switch (alt1) {
case 1 :
// InternalMyDsl.g:79:3: ( ( (lv_statements_0_0= ruleInstruction ) ) this_NL_1= RULE_NL )
{
// InternalMyDsl.g:79:3: ( ( (lv_statements_0_0= ruleInstruction ) ) this_NL_1= RULE_NL )
// InternalMyDsl.g:80:4: ( (lv_statements_0_0= ruleInstruction ) ) this_NL_1= RULE_NL
{
// InternalMyDsl.g:80:4: ( (lv_statements_0_0= ruleInstruction ) )
// InternalMyDsl.g:81:5: (lv_statements_0_0= ruleInstruction )
{
// InternalMyDsl.g:81:5: (lv_statements_0_0= ruleInstruction )
// InternalMyDsl.g:82:6: lv_statements_0_0= ruleInstruction
{
newCompositeNode(grammarAccess.getDockerfileAccess().getStatementsInstructionParserRuleCall_0_0_0());
pushFollow(FOLLOW_3);
lv_statements_0_0=ruleInstruction();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getDockerfileRule());
}
add(
current,
"statements",
lv_statements_0_0,
"org.xtext.example.mydsl.MyDsl.Instruction");
afterParserOrEnumRuleCall();
}
}
this_NL_1=(Token)match(input,RULE_NL,FOLLOW_4);
newLeafNode(this_NL_1, grammarAccess.getDockerfileAccess().getNLTerminalRuleCall_0_1());
}
}
break;
case 2 :
// InternalMyDsl.g:105:3: ( ( (lv_comments_2_0= RULE_COMMENT ) ) this_NL_3= RULE_NL )
{
// InternalMyDsl.g:105:3: ( ( (lv_comments_2_0= RULE_COMMENT ) ) this_NL_3= RULE_NL )
// InternalMyDsl.g:106:4: ( (lv_comments_2_0= RULE_COMMENT ) ) this_NL_3= RULE_NL
{
// InternalMyDsl.g:106:4: ( (lv_comments_2_0= RULE_COMMENT ) )
// InternalMyDsl.g:107:5: (lv_comments_2_0= RULE_COMMENT )
{
// InternalMyDsl.g:107:5: (lv_comments_2_0= RULE_COMMENT )
// InternalMyDsl.g:108:6: lv_comments_2_0= RULE_COMMENT
{
lv_comments_2_0=(Token)match(input,RULE_COMMENT,FOLLOW_3);
newLeafNode(lv_comments_2_0, grammarAccess.getDockerfileAccess().getCommentsCOMMENTTerminalRuleCall_1_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getDockerfileRule());
}
addWithLastConsumed(
current,
"comments",
lv_comments_2_0,
"org.xtext.example.mydsl.MyDsl.COMMENT");
}
}
this_NL_3=(Token)match(input,RULE_NL,FOLLOW_4);
newLeafNode(this_NL_3, grammarAccess.getDockerfileAccess().getNLTerminalRuleCall_1_1());
}
}
break;
default :
break loop1;
}
} while (true);
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleDockerfile"
// $ANTLR start "entryRuleInstruction"
// InternalMyDsl.g:133:1: entryRuleInstruction returns [EObject current=null] : iv_ruleInstruction= ruleInstruction EOF ;
public final EObject entryRuleInstruction() throws RecognitionException {
EObject current = null;
EObject iv_ruleInstruction = null;
try {
// InternalMyDsl.g:133:52: (iv_ruleInstruction= ruleInstruction EOF )
// InternalMyDsl.g:134:2: iv_ruleInstruction= ruleInstruction EOF
{
newCompositeNode(grammarAccess.getInstructionRule());
pushFollow(FOLLOW_1);
iv_ruleInstruction=ruleInstruction();
state._fsp--;
current =iv_ruleInstruction;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleInstruction"
// $ANTLR start "ruleInstruction"
// InternalMyDsl.g:140:1: ruleInstruction returns [EObject current=null] : ( ( (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild ) ) ) ;
public final EObject ruleInstruction() throws RecognitionException {
EObject current = null;
EObject lv_statement_0_1 = null;
EObject lv_statement_0_2 = null;
EObject lv_statement_0_3 = null;
EObject lv_statement_0_4 = null;
EObject lv_statement_0_5 = null;
EObject lv_statement_0_6 = null;
EObject lv_statement_0_7 = null;
EObject lv_statement_0_8 = null;
EObject lv_statement_0_9 = null;
EObject lv_statement_0_10 = null;
EObject lv_statement_0_11 = null;
EObject lv_statement_0_12 = null;
EObject lv_statement_0_13 = null;
enterRule();
try {
// InternalMyDsl.g:146:2: ( ( ( (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild ) ) ) )
// InternalMyDsl.g:147:2: ( ( (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild ) ) )
{
// InternalMyDsl.g:147:2: ( ( (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild ) ) )
// InternalMyDsl.g:148:3: ( (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild ) )
{
// InternalMyDsl.g:148:3: ( (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild ) )
// InternalMyDsl.g:149:4: (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild )
{
// InternalMyDsl.g:149:4: (lv_statement_0_1= ruleFrom | lv_statement_0_2= ruleCmd | lv_statement_0_3= ruleEntrypoint | lv_statement_0_4= ruleVolume | lv_statement_0_5= ruleMaintainer | lv_statement_0_6= ruleExpose | lv_statement_0_7= ruleWorkdir | lv_statement_0_8= ruleRun | lv_statement_0_9= ruleEnv | lv_statement_0_10= ruleLabel | lv_statement_0_11= ruleAdd | lv_statement_0_12= ruleCopy | lv_statement_0_13= ruleOnbuild )
int alt2=13;
switch ( input.LA(1) ) {
case 14:
{
alt2=1;
}
break;
case 15:
{
alt2=2;
}
break;
case 17:
{
alt2=3;
}
break;
case 18:
{
alt2=4;
}
break;
case 19:
{
alt2=5;
}
break;
case 20:
{
alt2=6;
}
break;
case 21:
{
alt2=7;
}
break;
case 16:
{
alt2=8;
}
break;
case 22:
{
alt2=9;
}
break;
case 23:
{
alt2=10;
}
break;
case 24:
{
alt2=11;
}
break;
case 28:
{
alt2=12;
}
break;
case 29:
{
alt2=13;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 2, 0, input);
throw nvae;
}
switch (alt2) {
case 1 :
// InternalMyDsl.g:150:5: lv_statement_0_1= ruleFrom
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementFromParserRuleCall_0_0());
pushFollow(FOLLOW_2);
lv_statement_0_1=ruleFrom();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_1,
"org.xtext.example.mydsl.MyDsl.From");
afterParserOrEnumRuleCall();
}
break;
case 2 :
// InternalMyDsl.g:166:5: lv_statement_0_2= ruleCmd
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementCmdParserRuleCall_0_1());
pushFollow(FOLLOW_2);
lv_statement_0_2=ruleCmd();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_2,
"org.xtext.example.mydsl.MyDsl.Cmd");
afterParserOrEnumRuleCall();
}
break;
case 3 :
// InternalMyDsl.g:182:5: lv_statement_0_3= ruleEntrypoint
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementEntrypointParserRuleCall_0_2());
pushFollow(FOLLOW_2);
lv_statement_0_3=ruleEntrypoint();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_3,
"org.xtext.example.mydsl.MyDsl.Entrypoint");
afterParserOrEnumRuleCall();
}
break;
case 4 :
// InternalMyDsl.g:198:5: lv_statement_0_4= ruleVolume
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementVolumeParserRuleCall_0_3());
pushFollow(FOLLOW_2);
lv_statement_0_4=ruleVolume();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_4,
"org.xtext.example.mydsl.MyDsl.Volume");
afterParserOrEnumRuleCall();
}
break;
case 5 :
// InternalMyDsl.g:214:5: lv_statement_0_5= ruleMaintainer
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementMaintainerParserRuleCall_0_4());
pushFollow(FOLLOW_2);
lv_statement_0_5=ruleMaintainer();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_5,
"org.xtext.example.mydsl.MyDsl.Maintainer");
afterParserOrEnumRuleCall();
}
break;
case 6 :
// InternalMyDsl.g:230:5: lv_statement_0_6= ruleExpose
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementExposeParserRuleCall_0_5());
pushFollow(FOLLOW_2);
lv_statement_0_6=ruleExpose();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_6,
"org.xtext.example.mydsl.MyDsl.Expose");
afterParserOrEnumRuleCall();
}
break;
case 7 :
// InternalMyDsl.g:246:5: lv_statement_0_7= ruleWorkdir
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementWorkdirParserRuleCall_0_6());
pushFollow(FOLLOW_2);
lv_statement_0_7=ruleWorkdir();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_7,
"org.xtext.example.mydsl.MyDsl.Workdir");
afterParserOrEnumRuleCall();
}
break;
case 8 :
// InternalMyDsl.g:262:5: lv_statement_0_8= ruleRun
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementRunParserRuleCall_0_7());
pushFollow(FOLLOW_2);
lv_statement_0_8=ruleRun();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_8,
"org.xtext.example.mydsl.MyDsl.Run");
afterParserOrEnumRuleCall();
}
break;
case 9 :
// InternalMyDsl.g:278:5: lv_statement_0_9= ruleEnv
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementEnvParserRuleCall_0_8());
pushFollow(FOLLOW_2);
lv_statement_0_9=ruleEnv();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_9,
"org.xtext.example.mydsl.MyDsl.Env");
afterParserOrEnumRuleCall();
}
break;
case 10 :
// InternalMyDsl.g:294:5: lv_statement_0_10= ruleLabel
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementLabelParserRuleCall_0_9());
pushFollow(FOLLOW_2);
lv_statement_0_10=ruleLabel();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_10,
"org.xtext.example.mydsl.MyDsl.Label");
afterParserOrEnumRuleCall();
}
break;
case 11 :
// InternalMyDsl.g:310:5: lv_statement_0_11= ruleAdd
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementAddParserRuleCall_0_10());
pushFollow(FOLLOW_2);
lv_statement_0_11=ruleAdd();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_11,
"org.xtext.example.mydsl.MyDsl.Add");
afterParserOrEnumRuleCall();
}
break;
case 12 :
// InternalMyDsl.g:326:5: lv_statement_0_12= ruleCopy
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementCopyParserRuleCall_0_11());
pushFollow(FOLLOW_2);
lv_statement_0_12=ruleCopy();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_12,
"org.xtext.example.mydsl.MyDsl.Copy");
afterParserOrEnumRuleCall();
}
break;
case 13 :
// InternalMyDsl.g:342:5: lv_statement_0_13= ruleOnbuild
{
newCompositeNode(grammarAccess.getInstructionAccess().getStatementOnbuildParserRuleCall_0_12());
pushFollow(FOLLOW_2);
lv_statement_0_13=ruleOnbuild();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getInstructionRule());
}
set(
current,
"statement",
lv_statement_0_13,
"org.xtext.example.mydsl.MyDsl.Onbuild");
afterParserOrEnumRuleCall();
}
break;
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleInstruction"
// $ANTLR start "entryRuleFrom"
// InternalMyDsl.g:363:1: entryRuleFrom returns [EObject current=null] : iv_ruleFrom= ruleFrom EOF ;
public final EObject entryRuleFrom() throws RecognitionException {
EObject current = null;
EObject iv_ruleFrom = null;
try {
// InternalMyDsl.g:363:45: (iv_ruleFrom= ruleFrom EOF )
// InternalMyDsl.g:364:2: iv_ruleFrom= ruleFrom EOF
{
newCompositeNode(grammarAccess.getFromRule());
pushFollow(FOLLOW_1);
iv_ruleFrom=ruleFrom();
state._fsp--;
current =iv_ruleFrom;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleFrom"
// $ANTLR start "ruleFrom"
// InternalMyDsl.g:370:1: ruleFrom returns [EObject current=null] : ( ( (lv_key_0_0= 'FROM ' ) ) ( (lv_platform_option_1_0= RULE_PLATFORM_OPTION ) )? ( (lv_name_2_0= ruleIMAGE_NAME ) ) ( ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) ) )? ) ;
public final EObject ruleFrom() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_platform_option_1_0=null;
AntlrDatatypeRuleToken lv_name_2_0 = null;
AntlrDatatypeRuleToken lv_tag_or_digest_3_1 = null;
AntlrDatatypeRuleToken lv_tag_or_digest_3_2 = null;
enterRule();
try {
// InternalMyDsl.g:376:2: ( ( ( (lv_key_0_0= 'FROM ' ) ) ( (lv_platform_option_1_0= RULE_PLATFORM_OPTION ) )? ( (lv_name_2_0= ruleIMAGE_NAME ) ) ( ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) ) )? ) )
// InternalMyDsl.g:377:2: ( ( (lv_key_0_0= 'FROM ' ) ) ( (lv_platform_option_1_0= RULE_PLATFORM_OPTION ) )? ( (lv_name_2_0= ruleIMAGE_NAME ) ) ( ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) ) )? )
{
// InternalMyDsl.g:377:2: ( ( (lv_key_0_0= 'FROM ' ) ) ( (lv_platform_option_1_0= RULE_PLATFORM_OPTION ) )? ( (lv_name_2_0= ruleIMAGE_NAME ) ) ( ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) ) )? )
// InternalMyDsl.g:378:3: ( (lv_key_0_0= 'FROM ' ) ) ( (lv_platform_option_1_0= RULE_PLATFORM_OPTION ) )? ( (lv_name_2_0= ruleIMAGE_NAME ) ) ( ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) ) )?
{
// InternalMyDsl.g:378:3: ( (lv_key_0_0= 'FROM ' ) )
// InternalMyDsl.g:379:4: (lv_key_0_0= 'FROM ' )
{
// InternalMyDsl.g:379:4: (lv_key_0_0= 'FROM ' )
// InternalMyDsl.g:380:5: lv_key_0_0= 'FROM '
{
lv_key_0_0=(Token)match(input,14,FOLLOW_5);
newLeafNode(lv_key_0_0, grammarAccess.getFromAccess().getKeyFROMKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getFromRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "FROM ");
}
}
// InternalMyDsl.g:392:3: ( (lv_platform_option_1_0= RULE_PLATFORM_OPTION ) )?
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0==RULE_PLATFORM_OPTION) ) {
alt3=1;
}
switch (alt3) {
case 1 :
// InternalMyDsl.g:393:4: (lv_platform_option_1_0= RULE_PLATFORM_OPTION )
{
// InternalMyDsl.g:393:4: (lv_platform_option_1_0= RULE_PLATFORM_OPTION )
// InternalMyDsl.g:394:5: lv_platform_option_1_0= RULE_PLATFORM_OPTION
{
lv_platform_option_1_0=(Token)match(input,RULE_PLATFORM_OPTION,FOLLOW_5);
newLeafNode(lv_platform_option_1_0, grammarAccess.getFromAccess().getPlatform_optionPLATFORM_OPTIONTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getFromRule());
}
setWithLastConsumed(
current,
"platform_option",
lv_platform_option_1_0,
"org.xtext.example.mydsl.MyDsl.PLATFORM_OPTION");
}
}
break;
}
// InternalMyDsl.g:410:3: ( (lv_name_2_0= ruleIMAGE_NAME ) )
// InternalMyDsl.g:411:4: (lv_name_2_0= ruleIMAGE_NAME )
{
// InternalMyDsl.g:411:4: (lv_name_2_0= ruleIMAGE_NAME )
// InternalMyDsl.g:412:5: lv_name_2_0= ruleIMAGE_NAME
{
newCompositeNode(grammarAccess.getFromAccess().getNameIMAGE_NAMEParserRuleCall_2_0());
pushFollow(FOLLOW_6);
lv_name_2_0=ruleIMAGE_NAME();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getFromRule());
}
set(
current,
"name",
lv_name_2_0,
"org.xtext.example.mydsl.MyDsl.IMAGE_NAME");
afterParserOrEnumRuleCall();
}
}
// InternalMyDsl.g:429:3: ( ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) ) )?
int alt5=2;
int LA5_0 = input.LA(1);
if ( (LA5_0==31||LA5_0==33) ) {
alt5=1;
}
switch (alt5) {
case 1 :
// InternalMyDsl.g:430:4: ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) )
{
// InternalMyDsl.g:430:4: ( (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST ) )
// InternalMyDsl.g:431:5: (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST )
{
// InternalMyDsl.g:431:5: (lv_tag_or_digest_3_1= ruleIMAGE_TAG | lv_tag_or_digest_3_2= ruleIMAGE_DIGEST )
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0==31) ) {
alt4=1;
}
else if ( (LA4_0==33) ) {
alt4=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt4) {
case 1 :
// InternalMyDsl.g:432:6: lv_tag_or_digest_3_1= ruleIMAGE_TAG
{
newCompositeNode(grammarAccess.getFromAccess().getTag_or_digestIMAGE_TAGParserRuleCall_3_0_0());
pushFollow(FOLLOW_2);
lv_tag_or_digest_3_1=ruleIMAGE_TAG();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getFromRule());
}
set(
current,
"tag_or_digest",
lv_tag_or_digest_3_1,
"org.xtext.example.mydsl.MyDsl.IMAGE_TAG");
afterParserOrEnumRuleCall();
}
break;
case 2 :
// InternalMyDsl.g:448:6: lv_tag_or_digest_3_2= ruleIMAGE_DIGEST
{
newCompositeNode(grammarAccess.getFromAccess().getTag_or_digestIMAGE_DIGESTParserRuleCall_3_0_1());
pushFollow(FOLLOW_2);
lv_tag_or_digest_3_2=ruleIMAGE_DIGEST();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getFromRule());
}
set(
current,
"tag_or_digest",
lv_tag_or_digest_3_2,
"org.xtext.example.mydsl.MyDsl.IMAGE_DIGEST");
afterParserOrEnumRuleCall();
}
break;
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleFrom"
// $ANTLR start "entryRuleCmd"
// InternalMyDsl.g:470:1: entryRuleCmd returns [EObject current=null] : iv_ruleCmd= ruleCmd EOF ;
public final EObject entryRuleCmd() throws RecognitionException {
EObject current = null;
EObject iv_ruleCmd = null;
try {
// InternalMyDsl.g:470:44: (iv_ruleCmd= ruleCmd EOF )
// InternalMyDsl.g:471:2: iv_ruleCmd= ruleCmd EOF
{
newCompositeNode(grammarAccess.getCmdRule());
pushFollow(FOLLOW_1);
iv_ruleCmd=ruleCmd();
state._fsp--;
current =iv_ruleCmd;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleCmd"
// $ANTLR start "ruleCmd"
// InternalMyDsl.g:477:1: ruleCmd returns [EObject current=null] : ( ( (lv_key_0_0= 'CMD' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) ;
public final EObject ruleCmd() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_shell_form_2_0=null;
EObject lv_exec_form_1_0 = null;
enterRule();
try {
// InternalMyDsl.g:483:2: ( ( ( (lv_key_0_0= 'CMD' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) )
// InternalMyDsl.g:484:2: ( ( (lv_key_0_0= 'CMD' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
{
// InternalMyDsl.g:484:2: ( ( (lv_key_0_0= 'CMD' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:485:3: ( (lv_key_0_0= 'CMD' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:485:3: ( (lv_key_0_0= 'CMD' ) )
// InternalMyDsl.g:486:4: (lv_key_0_0= 'CMD' )
{
// InternalMyDsl.g:486:4: (lv_key_0_0= 'CMD' )
// InternalMyDsl.g:487:5: lv_key_0_0= 'CMD'
{
lv_key_0_0=(Token)match(input,15,FOLLOW_7);
newLeafNode(lv_key_0_0, grammarAccess.getCmdAccess().getKeyCMDKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getCmdRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "CMD");
}
}
// InternalMyDsl.g:499:3: ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==34) ) {
alt6=1;
}
else if ( (LA6_0==RULE_SHELL_CMD) ) {
alt6=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 6, 0, input);
throw nvae;
}
switch (alt6) {
case 1 :
// InternalMyDsl.g:500:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
{
// InternalMyDsl.g:500:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
// InternalMyDsl.g:501:5: (lv_exec_form_1_0= ruleEXEC_FORM )
{
// InternalMyDsl.g:501:5: (lv_exec_form_1_0= ruleEXEC_FORM )
// InternalMyDsl.g:502:6: lv_exec_form_1_0= ruleEXEC_FORM
{
newCompositeNode(grammarAccess.getCmdAccess().getExec_formEXEC_FORMParserRuleCall_1_0_0());
pushFollow(FOLLOW_2);
lv_exec_form_1_0=ruleEXEC_FORM();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getCmdRule());
}
set(
current,
"exec_form",
lv_exec_form_1_0,
"org.xtext.example.mydsl.MyDsl.EXEC_FORM");
afterParserOrEnumRuleCall();
}
}
}
break;
case 2 :
// InternalMyDsl.g:520:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:520:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:521:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:521:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
// InternalMyDsl.g:522:6: lv_shell_form_2_0= RULE_SHELL_CMD
{
lv_shell_form_2_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_shell_form_2_0, grammarAccess.getCmdAccess().getShell_formSHELL_CMDTerminalRuleCall_1_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getCmdRule());
}
setWithLastConsumed(
current,
"shell_form",
lv_shell_form_2_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleCmd"
// $ANTLR start "entryRuleRun"
// InternalMyDsl.g:543:1: entryRuleRun returns [EObject current=null] : iv_ruleRun= ruleRun EOF ;
public final EObject entryRuleRun() throws RecognitionException {
EObject current = null;
EObject iv_ruleRun = null;
try {
// InternalMyDsl.g:543:44: (iv_ruleRun= ruleRun EOF )
// InternalMyDsl.g:544:2: iv_ruleRun= ruleRun EOF
{
newCompositeNode(grammarAccess.getRunRule());
pushFollow(FOLLOW_1);
iv_ruleRun=ruleRun();
state._fsp--;
current =iv_ruleRun;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleRun"
// $ANTLR start "ruleRun"
// InternalMyDsl.g:550:1: ruleRun returns [EObject current=null] : ( ( (lv_key_0_0= 'RUN' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) ;
public final EObject ruleRun() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_shell_form_2_0=null;
EObject lv_exec_form_1_0 = null;
enterRule();
try {
// InternalMyDsl.g:556:2: ( ( ( (lv_key_0_0= 'RUN' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) )
// InternalMyDsl.g:557:2: ( ( (lv_key_0_0= 'RUN' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
{
// InternalMyDsl.g:557:2: ( ( (lv_key_0_0= 'RUN' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:558:3: ( (lv_key_0_0= 'RUN' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:558:3: ( (lv_key_0_0= 'RUN' ) )
// InternalMyDsl.g:559:4: (lv_key_0_0= 'RUN' )
{
// InternalMyDsl.g:559:4: (lv_key_0_0= 'RUN' )
// InternalMyDsl.g:560:5: lv_key_0_0= 'RUN'
{
lv_key_0_0=(Token)match(input,16,FOLLOW_7);
newLeafNode(lv_key_0_0, grammarAccess.getRunAccess().getKeyRUNKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getRunRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "RUN");
}
}
// InternalMyDsl.g:572:3: ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0==34) ) {
alt7=1;
}
else if ( (LA7_0==RULE_SHELL_CMD) ) {
alt7=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 7, 0, input);
throw nvae;
}
switch (alt7) {
case 1 :
// InternalMyDsl.g:573:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
{
// InternalMyDsl.g:573:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
// InternalMyDsl.g:574:5: (lv_exec_form_1_0= ruleEXEC_FORM )
{
// InternalMyDsl.g:574:5: (lv_exec_form_1_0= ruleEXEC_FORM )
// InternalMyDsl.g:575:6: lv_exec_form_1_0= ruleEXEC_FORM
{
newCompositeNode(grammarAccess.getRunAccess().getExec_formEXEC_FORMParserRuleCall_1_0_0());
pushFollow(FOLLOW_2);
lv_exec_form_1_0=ruleEXEC_FORM();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getRunRule());
}
set(
current,
"exec_form",
lv_exec_form_1_0,
"org.xtext.example.mydsl.MyDsl.EXEC_FORM");
afterParserOrEnumRuleCall();
}
}
}
break;
case 2 :
// InternalMyDsl.g:593:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:593:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:594:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:594:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
// InternalMyDsl.g:595:6: lv_shell_form_2_0= RULE_SHELL_CMD
{
lv_shell_form_2_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_shell_form_2_0, grammarAccess.getRunAccess().getShell_formSHELL_CMDTerminalRuleCall_1_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getRunRule());
}
setWithLastConsumed(
current,
"shell_form",
lv_shell_form_2_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleRun"
// $ANTLR start "entryRuleEntrypoint"
// InternalMyDsl.g:616:1: entryRuleEntrypoint returns [EObject current=null] : iv_ruleEntrypoint= ruleEntrypoint EOF ;
public final EObject entryRuleEntrypoint() throws RecognitionException {
EObject current = null;
EObject iv_ruleEntrypoint = null;
try {
// InternalMyDsl.g:616:51: (iv_ruleEntrypoint= ruleEntrypoint EOF )
// InternalMyDsl.g:617:2: iv_ruleEntrypoint= ruleEntrypoint EOF
{
newCompositeNode(grammarAccess.getEntrypointRule());
pushFollow(FOLLOW_1);
iv_ruleEntrypoint=ruleEntrypoint();
state._fsp--;
current =iv_ruleEntrypoint;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleEntrypoint"
// $ANTLR start "ruleEntrypoint"
// InternalMyDsl.g:623:1: ruleEntrypoint returns [EObject current=null] : ( ( (lv_key_0_0= 'ENTRYPOINT' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) ;
public final EObject ruleEntrypoint() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_shell_form_2_0=null;
EObject lv_exec_form_1_0 = null;
enterRule();
try {
// InternalMyDsl.g:629:2: ( ( ( (lv_key_0_0= 'ENTRYPOINT' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) )
// InternalMyDsl.g:630:2: ( ( (lv_key_0_0= 'ENTRYPOINT' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
{
// InternalMyDsl.g:630:2: ( ( (lv_key_0_0= 'ENTRYPOINT' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:631:3: ( (lv_key_0_0= 'ENTRYPOINT' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:631:3: ( (lv_key_0_0= 'ENTRYPOINT' ) )
// InternalMyDsl.g:632:4: (lv_key_0_0= 'ENTRYPOINT' )
{
// InternalMyDsl.g:632:4: (lv_key_0_0= 'ENTRYPOINT' )
// InternalMyDsl.g:633:5: lv_key_0_0= 'ENTRYPOINT'
{
lv_key_0_0=(Token)match(input,17,FOLLOW_7);
newLeafNode(lv_key_0_0, grammarAccess.getEntrypointAccess().getKeyENTRYPOINTKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getEntrypointRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "ENTRYPOINT");
}
}
// InternalMyDsl.g:645:3: ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==34) ) {
alt8=1;
}
else if ( (LA8_0==RULE_SHELL_CMD) ) {
alt8=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 8, 0, input);
throw nvae;
}
switch (alt8) {
case 1 :
// InternalMyDsl.g:646:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
{
// InternalMyDsl.g:646:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
// InternalMyDsl.g:647:5: (lv_exec_form_1_0= ruleEXEC_FORM )
{
// InternalMyDsl.g:647:5: (lv_exec_form_1_0= ruleEXEC_FORM )
// InternalMyDsl.g:648:6: lv_exec_form_1_0= ruleEXEC_FORM
{
newCompositeNode(grammarAccess.getEntrypointAccess().getExec_formEXEC_FORMParserRuleCall_1_0_0());
pushFollow(FOLLOW_2);
lv_exec_form_1_0=ruleEXEC_FORM();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getEntrypointRule());
}
set(
current,
"exec_form",
lv_exec_form_1_0,
"org.xtext.example.mydsl.MyDsl.EXEC_FORM");
afterParserOrEnumRuleCall();
}
}
}
break;
case 2 :
// InternalMyDsl.g:666:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:666:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:667:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:667:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
// InternalMyDsl.g:668:6: lv_shell_form_2_0= RULE_SHELL_CMD
{
lv_shell_form_2_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_shell_form_2_0, grammarAccess.getEntrypointAccess().getShell_formSHELL_CMDTerminalRuleCall_1_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getEntrypointRule());
}
setWithLastConsumed(
current,
"shell_form",
lv_shell_form_2_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleEntrypoint"
// $ANTLR start "entryRuleVolume"
// InternalMyDsl.g:689:1: entryRuleVolume returns [EObject current=null] : iv_ruleVolume= ruleVolume EOF ;
public final EObject entryRuleVolume() throws RecognitionException {
EObject current = null;
EObject iv_ruleVolume = null;
try {
// InternalMyDsl.g:689:47: (iv_ruleVolume= ruleVolume EOF )
// InternalMyDsl.g:690:2: iv_ruleVolume= ruleVolume EOF
{
newCompositeNode(grammarAccess.getVolumeRule());
pushFollow(FOLLOW_1);
iv_ruleVolume=ruleVolume();
state._fsp--;
current =iv_ruleVolume;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleVolume"
// $ANTLR start "ruleVolume"
// InternalMyDsl.g:696:1: ruleVolume returns [EObject current=null] : ( ( (lv_key_0_0= 'VOLUME' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) ;
public final EObject ruleVolume() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_shell_form_2_0=null;
EObject lv_exec_form_1_0 = null;
enterRule();
try {
// InternalMyDsl.g:702:2: ( ( ( (lv_key_0_0= 'VOLUME' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) ) )
// InternalMyDsl.g:703:2: ( ( (lv_key_0_0= 'VOLUME' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
{
// InternalMyDsl.g:703:2: ( ( (lv_key_0_0= 'VOLUME' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:704:3: ( (lv_key_0_0= 'VOLUME' ) ) ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:704:3: ( (lv_key_0_0= 'VOLUME' ) )
// InternalMyDsl.g:705:4: (lv_key_0_0= 'VOLUME' )
{
// InternalMyDsl.g:705:4: (lv_key_0_0= 'VOLUME' )
// InternalMyDsl.g:706:5: lv_key_0_0= 'VOLUME'
{
lv_key_0_0=(Token)match(input,18,FOLLOW_7);
newLeafNode(lv_key_0_0, grammarAccess.getVolumeAccess().getKeyVOLUMEKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getVolumeRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "VOLUME");
}
}
// InternalMyDsl.g:718:3: ( ( (lv_exec_form_1_0= ruleEXEC_FORM ) ) | ( (lv_shell_form_2_0= RULE_SHELL_CMD ) ) )
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0==34) ) {
alt9=1;
}
else if ( (LA9_0==RULE_SHELL_CMD) ) {
alt9=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 9, 0, input);
throw nvae;
}
switch (alt9) {
case 1 :
// InternalMyDsl.g:719:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
{
// InternalMyDsl.g:719:4: ( (lv_exec_form_1_0= ruleEXEC_FORM ) )
// InternalMyDsl.g:720:5: (lv_exec_form_1_0= ruleEXEC_FORM )
{
// InternalMyDsl.g:720:5: (lv_exec_form_1_0= ruleEXEC_FORM )
// InternalMyDsl.g:721:6: lv_exec_form_1_0= ruleEXEC_FORM
{
newCompositeNode(grammarAccess.getVolumeAccess().getExec_formEXEC_FORMParserRuleCall_1_0_0());
pushFollow(FOLLOW_2);
lv_exec_form_1_0=ruleEXEC_FORM();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getVolumeRule());
}
set(
current,
"exec_form",
lv_exec_form_1_0,
"org.xtext.example.mydsl.MyDsl.EXEC_FORM");
afterParserOrEnumRuleCall();
}
}
}
break;
case 2 :
// InternalMyDsl.g:739:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:739:4: ( (lv_shell_form_2_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:740:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:740:5: (lv_shell_form_2_0= RULE_SHELL_CMD )
// InternalMyDsl.g:741:6: lv_shell_form_2_0= RULE_SHELL_CMD
{
lv_shell_form_2_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_shell_form_2_0, grammarAccess.getVolumeAccess().getShell_formSHELL_CMDTerminalRuleCall_1_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getVolumeRule());
}
setWithLastConsumed(
current,
"shell_form",
lv_shell_form_2_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleVolume"
// $ANTLR start "entryRuleMaintainer"
// InternalMyDsl.g:762:1: entryRuleMaintainer returns [EObject current=null] : iv_ruleMaintainer= ruleMaintainer EOF ;
public final EObject entryRuleMaintainer() throws RecognitionException {
EObject current = null;
EObject iv_ruleMaintainer = null;
try {
// InternalMyDsl.g:762:51: (iv_ruleMaintainer= ruleMaintainer EOF )
// InternalMyDsl.g:763:2: iv_ruleMaintainer= ruleMaintainer EOF
{
newCompositeNode(grammarAccess.getMaintainerRule());
pushFollow(FOLLOW_1);
iv_ruleMaintainer=ruleMaintainer();
state._fsp--;
current =iv_ruleMaintainer;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleMaintainer"
// $ANTLR start "ruleMaintainer"
// InternalMyDsl.g:769:1: ruleMaintainer returns [EObject current=null] : ( ( (lv_key_0_0= 'MAINTAINER' ) ) ( (lv_name_1_0= RULE_SHELL_CMD ) ) ) ;
public final EObject ruleMaintainer() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_name_1_0=null;
enterRule();
try {
// InternalMyDsl.g:775:2: ( ( ( (lv_key_0_0= 'MAINTAINER' ) ) ( (lv_name_1_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:776:2: ( ( (lv_key_0_0= 'MAINTAINER' ) ) ( (lv_name_1_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:776:2: ( ( (lv_key_0_0= 'MAINTAINER' ) ) ( (lv_name_1_0= RULE_SHELL_CMD ) ) )
// InternalMyDsl.g:777:3: ( (lv_key_0_0= 'MAINTAINER' ) ) ( (lv_name_1_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:777:3: ( (lv_key_0_0= 'MAINTAINER' ) )
// InternalMyDsl.g:778:4: (lv_key_0_0= 'MAINTAINER' )
{
// InternalMyDsl.g:778:4: (lv_key_0_0= 'MAINTAINER' )
// InternalMyDsl.g:779:5: lv_key_0_0= 'MAINTAINER'
{
lv_key_0_0=(Token)match(input,19,FOLLOW_8);
newLeafNode(lv_key_0_0, grammarAccess.getMaintainerAccess().getKeyMAINTAINERKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getMaintainerRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "MAINTAINER");
}
}
// InternalMyDsl.g:791:3: ( (lv_name_1_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:792:4: (lv_name_1_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:792:4: (lv_name_1_0= RULE_SHELL_CMD )
// InternalMyDsl.g:793:5: lv_name_1_0= RULE_SHELL_CMD
{
lv_name_1_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_name_1_0, grammarAccess.getMaintainerAccess().getNameSHELL_CMDTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getMaintainerRule());
}
setWithLastConsumed(
current,
"name",
lv_name_1_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleMaintainer"
// $ANTLR start "entryRuleExpose"
// InternalMyDsl.g:813:1: entryRuleExpose returns [EObject current=null] : iv_ruleExpose= ruleExpose EOF ;
public final EObject entryRuleExpose() throws RecognitionException {
EObject current = null;
EObject iv_ruleExpose = null;
try {
// InternalMyDsl.g:813:47: (iv_ruleExpose= ruleExpose EOF )
// InternalMyDsl.g:814:2: iv_ruleExpose= ruleExpose EOF
{
newCompositeNode(grammarAccess.getExposeRule());
pushFollow(FOLLOW_1);
iv_ruleExpose=ruleExpose();
state._fsp--;
current =iv_ruleExpose;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleExpose"
// $ANTLR start "ruleExpose"
// InternalMyDsl.g:820:1: ruleExpose returns [EObject current=null] : ( ( (lv_key_0_0= 'EXPOSE' ) ) ( (lv_ports_1_0= RULE_SHELL_CMD ) ) ) ;
public final EObject ruleExpose() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_ports_1_0=null;
enterRule();
try {
// InternalMyDsl.g:826:2: ( ( ( (lv_key_0_0= 'EXPOSE' ) ) ( (lv_ports_1_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:827:2: ( ( (lv_key_0_0= 'EXPOSE' ) ) ( (lv_ports_1_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:827:2: ( ( (lv_key_0_0= 'EXPOSE' ) ) ( (lv_ports_1_0= RULE_SHELL_CMD ) ) )
// InternalMyDsl.g:828:3: ( (lv_key_0_0= 'EXPOSE' ) ) ( (lv_ports_1_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:828:3: ( (lv_key_0_0= 'EXPOSE' ) )
// InternalMyDsl.g:829:4: (lv_key_0_0= 'EXPOSE' )
{
// InternalMyDsl.g:829:4: (lv_key_0_0= 'EXPOSE' )
// InternalMyDsl.g:830:5: lv_key_0_0= 'EXPOSE'
{
lv_key_0_0=(Token)match(input,20,FOLLOW_8);
newLeafNode(lv_key_0_0, grammarAccess.getExposeAccess().getKeyEXPOSEKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getExposeRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "EXPOSE");
}
}
// InternalMyDsl.g:842:3: ( (lv_ports_1_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:843:4: (lv_ports_1_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:843:4: (lv_ports_1_0= RULE_SHELL_CMD )
// InternalMyDsl.g:844:5: lv_ports_1_0= RULE_SHELL_CMD
{
lv_ports_1_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_ports_1_0, grammarAccess.getExposeAccess().getPortsSHELL_CMDTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getExposeRule());
}
setWithLastConsumed(
current,
"ports",
lv_ports_1_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleExpose"
// $ANTLR start "entryRuleWorkdir"
// InternalMyDsl.g:864:1: entryRuleWorkdir returns [EObject current=null] : iv_ruleWorkdir= ruleWorkdir EOF ;
public final EObject entryRuleWorkdir() throws RecognitionException {
EObject current = null;
EObject iv_ruleWorkdir = null;
try {
// InternalMyDsl.g:864:48: (iv_ruleWorkdir= ruleWorkdir EOF )
// InternalMyDsl.g:865:2: iv_ruleWorkdir= ruleWorkdir EOF
{
newCompositeNode(grammarAccess.getWorkdirRule());
pushFollow(FOLLOW_1);
iv_ruleWorkdir=ruleWorkdir();
state._fsp--;
current =iv_ruleWorkdir;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleWorkdir"
// $ANTLR start "ruleWorkdir"
// InternalMyDsl.g:871:1: ruleWorkdir returns [EObject current=null] : ( ( (lv_key_0_0= 'WORKDIR' ) ) ( (lv_path_1_0= RULE_SHELL_CMD ) ) ) ;
public final EObject ruleWorkdir() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_path_1_0=null;
enterRule();
try {
// InternalMyDsl.g:877:2: ( ( ( (lv_key_0_0= 'WORKDIR' ) ) ( (lv_path_1_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:878:2: ( ( (lv_key_0_0= 'WORKDIR' ) ) ( (lv_path_1_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:878:2: ( ( (lv_key_0_0= 'WORKDIR' ) ) ( (lv_path_1_0= RULE_SHELL_CMD ) ) )
// InternalMyDsl.g:879:3: ( (lv_key_0_0= 'WORKDIR' ) ) ( (lv_path_1_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:879:3: ( (lv_key_0_0= 'WORKDIR' ) )
// InternalMyDsl.g:880:4: (lv_key_0_0= 'WORKDIR' )
{
// InternalMyDsl.g:880:4: (lv_key_0_0= 'WORKDIR' )
// InternalMyDsl.g:881:5: lv_key_0_0= 'WORKDIR'
{
lv_key_0_0=(Token)match(input,21,FOLLOW_8);
newLeafNode(lv_key_0_0, grammarAccess.getWorkdirAccess().getKeyWORKDIRKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getWorkdirRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "WORKDIR");
}
}
// InternalMyDsl.g:893:3: ( (lv_path_1_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:894:4: (lv_path_1_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:894:4: (lv_path_1_0= RULE_SHELL_CMD )
// InternalMyDsl.g:895:5: lv_path_1_0= RULE_SHELL_CMD
{
lv_path_1_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_path_1_0, grammarAccess.getWorkdirAccess().getPathSHELL_CMDTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getWorkdirRule());
}
setWithLastConsumed(
current,
"path",
lv_path_1_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleWorkdir"
// $ANTLR start "entryRuleEnv"
// InternalMyDsl.g:915:1: entryRuleEnv returns [EObject current=null] : iv_ruleEnv= ruleEnv EOF ;
public final EObject entryRuleEnv() throws RecognitionException {
EObject current = null;
EObject iv_ruleEnv = null;
try {
// InternalMyDsl.g:915:44: (iv_ruleEnv= ruleEnv EOF )
// InternalMyDsl.g:916:2: iv_ruleEnv= ruleEnv EOF
{
newCompositeNode(grammarAccess.getEnvRule());
pushFollow(FOLLOW_1);
iv_ruleEnv=ruleEnv();
state._fsp--;
current =iv_ruleEnv;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleEnv"
// $ANTLR start "ruleEnv"
// InternalMyDsl.g:922:1: ruleEnv returns [EObject current=null] : ( ( (lv_key_0_0= 'ENV ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ ) ;
public final EObject ruleEnv() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_key_value_pairs_1_0=null;
enterRule();
try {
// InternalMyDsl.g:928:2: ( ( ( (lv_key_0_0= 'ENV ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ ) )
// InternalMyDsl.g:929:2: ( ( (lv_key_0_0= 'ENV ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ )
{
// InternalMyDsl.g:929:2: ( ( (lv_key_0_0= 'ENV ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ )
// InternalMyDsl.g:930:3: ( (lv_key_0_0= 'ENV ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+
{
// InternalMyDsl.g:930:3: ( (lv_key_0_0= 'ENV ' ) )
// InternalMyDsl.g:931:4: (lv_key_0_0= 'ENV ' )
{
// InternalMyDsl.g:931:4: (lv_key_0_0= 'ENV ' )
// InternalMyDsl.g:932:5: lv_key_0_0= 'ENV '
{
lv_key_0_0=(Token)match(input,22,FOLLOW_9);
newLeafNode(lv_key_0_0, grammarAccess.getEnvAccess().getKeyENVKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getEnvRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "ENV ");
}
}
// InternalMyDsl.g:944:3: ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+
int cnt10=0;
loop10:
do {
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0==RULE_KV_PAIR_EQUALS) ) {
alt10=1;
}
switch (alt10) {
case 1 :
// InternalMyDsl.g:945:4: (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS )
{
// InternalMyDsl.g:945:4: (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS )
// InternalMyDsl.g:946:5: lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS
{
lv_key_value_pairs_1_0=(Token)match(input,RULE_KV_PAIR_EQUALS,FOLLOW_10);
newLeafNode(lv_key_value_pairs_1_0, grammarAccess.getEnvAccess().getKey_value_pairsKV_PAIR_EQUALSTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getEnvRule());
}
addWithLastConsumed(
current,
"key_value_pairs",
lv_key_value_pairs_1_0,
"org.xtext.example.mydsl.MyDsl.KV_PAIR_EQUALS");
}
}
break;
default :
if ( cnt10 >= 1 ) break loop10;
EarlyExitException eee =
new EarlyExitException(10, input);
throw eee;
}
cnt10++;
} while (true);
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleEnv"
// $ANTLR start "entryRuleLabel"
// InternalMyDsl.g:966:1: entryRuleLabel returns [EObject current=null] : iv_ruleLabel= ruleLabel EOF ;
public final EObject entryRuleLabel() throws RecognitionException {
EObject current = null;
EObject iv_ruleLabel = null;
try {
// InternalMyDsl.g:966:46: (iv_ruleLabel= ruleLabel EOF )
// InternalMyDsl.g:967:2: iv_ruleLabel= ruleLabel EOF
{
newCompositeNode(grammarAccess.getLabelRule());
pushFollow(FOLLOW_1);
iv_ruleLabel=ruleLabel();
state._fsp--;
current =iv_ruleLabel;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleLabel"
// $ANTLR start "ruleLabel"
// InternalMyDsl.g:973:1: ruleLabel returns [EObject current=null] : ( ( (lv_key_0_0= 'LABEL ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ ) ;
public final EObject ruleLabel() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_key_value_pairs_1_0=null;
enterRule();
try {
// InternalMyDsl.g:979:2: ( ( ( (lv_key_0_0= 'LABEL ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ ) )
// InternalMyDsl.g:980:2: ( ( (lv_key_0_0= 'LABEL ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ )
{
// InternalMyDsl.g:980:2: ( ( (lv_key_0_0= 'LABEL ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+ )
// InternalMyDsl.g:981:3: ( (lv_key_0_0= 'LABEL ' ) ) ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+
{
// InternalMyDsl.g:981:3: ( (lv_key_0_0= 'LABEL ' ) )
// InternalMyDsl.g:982:4: (lv_key_0_0= 'LABEL ' )
{
// InternalMyDsl.g:982:4: (lv_key_0_0= 'LABEL ' )
// InternalMyDsl.g:983:5: lv_key_0_0= 'LABEL '
{
lv_key_0_0=(Token)match(input,23,FOLLOW_9);
newLeafNode(lv_key_0_0, grammarAccess.getLabelAccess().getKeyLABELKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getLabelRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "LABEL ");
}
}
// InternalMyDsl.g:995:3: ( (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS ) )+
int cnt11=0;
loop11:
do {
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0==RULE_KV_PAIR_EQUALS) ) {
alt11=1;
}
switch (alt11) {
case 1 :
// InternalMyDsl.g:996:4: (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS )
{
// InternalMyDsl.g:996:4: (lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS )
// InternalMyDsl.g:997:5: lv_key_value_pairs_1_0= RULE_KV_PAIR_EQUALS
{
lv_key_value_pairs_1_0=(Token)match(input,RULE_KV_PAIR_EQUALS,FOLLOW_10);
newLeafNode(lv_key_value_pairs_1_0, grammarAccess.getLabelAccess().getKey_value_pairsKV_PAIR_EQUALSTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getLabelRule());
}
addWithLastConsumed(
current,
"key_value_pairs",
lv_key_value_pairs_1_0,
"org.xtext.example.mydsl.MyDsl.KV_PAIR_EQUALS");
}
}
break;
default :
if ( cnt11 >= 1 ) break loop11;
EarlyExitException eee =
new EarlyExitException(11, input);
throw eee;
}
cnt11++;
} while (true);
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleLabel"
// $ANTLR start "entryRuleAdd"
// InternalMyDsl.g:1017:1: entryRuleAdd returns [EObject current=null] : iv_ruleAdd= ruleAdd EOF ;
public final EObject entryRuleAdd() throws RecognitionException {
EObject current = null;
EObject iv_ruleAdd = null;
try {
// InternalMyDsl.g:1017:44: (iv_ruleAdd= ruleAdd EOF )
// InternalMyDsl.g:1018:2: iv_ruleAdd= ruleAdd EOF
{
newCompositeNode(grammarAccess.getAddRule());
pushFollow(FOLLOW_1);
iv_ruleAdd=ruleAdd();
state._fsp--;
current =iv_ruleAdd;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleAdd"
// $ANTLR start "ruleAdd"
// InternalMyDsl.g:1024:1: ruleAdd returns [EObject current=null] : ( ( (lv_key_0_0= 'ADD ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) ( (otherlv_3= '?' | otherlv_4= '*' ) | (otherlv_5= '.' this_ID_6= RULE_ID ) )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) ) ;
public final EObject ruleAdd() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_chown_options_1_0=null;
Token lv_file_2_0=null;
Token otherlv_3=null;
Token otherlv_4=null;
Token otherlv_5=null;
Token this_ID_6=null;
Token lv_directory_7_0=null;
enterRule();
try {
// InternalMyDsl.g:1030:2: ( ( ( (lv_key_0_0= 'ADD ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) ( (otherlv_3= '?' | otherlv_4= '*' ) | (otherlv_5= '.' this_ID_6= RULE_ID ) )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:1031:2: ( ( (lv_key_0_0= 'ADD ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) ( (otherlv_3= '?' | otherlv_4= '*' ) | (otherlv_5= '.' this_ID_6= RULE_ID ) )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:1031:2: ( ( (lv_key_0_0= 'ADD ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) ( (otherlv_3= '?' | otherlv_4= '*' ) | (otherlv_5= '.' this_ID_6= RULE_ID ) )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) )
// InternalMyDsl.g:1032:3: ( (lv_key_0_0= 'ADD ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) ( (otherlv_3= '?' | otherlv_4= '*' ) | (otherlv_5= '.' this_ID_6= RULE_ID ) )? ( (lv_directory_7_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:1032:3: ( (lv_key_0_0= 'ADD ' ) )
// InternalMyDsl.g:1033:4: (lv_key_0_0= 'ADD ' )
{
// InternalMyDsl.g:1033:4: (lv_key_0_0= 'ADD ' )
// InternalMyDsl.g:1034:5: lv_key_0_0= 'ADD '
{
lv_key_0_0=(Token)match(input,24,FOLLOW_11);
newLeafNode(lv_key_0_0, grammarAccess.getAddAccess().getKeyADDKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getAddRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "ADD ");
}
}
// InternalMyDsl.g:1046:3: ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )?
int alt12=2;
int LA12_0 = input.LA(1);
if ( (LA12_0==RULE_CHOWN_OPTION) ) {
alt12=1;
}
switch (alt12) {
case 1 :
// InternalMyDsl.g:1047:4: (lv_chown_options_1_0= RULE_CHOWN_OPTION )
{
// InternalMyDsl.g:1047:4: (lv_chown_options_1_0= RULE_CHOWN_OPTION )
// InternalMyDsl.g:1048:5: lv_chown_options_1_0= RULE_CHOWN_OPTION
{
lv_chown_options_1_0=(Token)match(input,RULE_CHOWN_OPTION,FOLLOW_12);
newLeafNode(lv_chown_options_1_0, grammarAccess.getAddAccess().getChown_optionsCHOWN_OPTIONTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getAddRule());
}
setWithLastConsumed(
current,
"chown_options",
lv_chown_options_1_0,
"org.xtext.example.mydsl.MyDsl.CHOWN_OPTION");
}
}
break;
}
// InternalMyDsl.g:1064:3: ( (lv_file_2_0= RULE_ID ) )
// InternalMyDsl.g:1065:4: (lv_file_2_0= RULE_ID )
{
// InternalMyDsl.g:1065:4: (lv_file_2_0= RULE_ID )
// InternalMyDsl.g:1066:5: lv_file_2_0= RULE_ID
{
lv_file_2_0=(Token)match(input,RULE_ID,FOLLOW_13);
newLeafNode(lv_file_2_0, grammarAccess.getAddAccess().getFileIDTerminalRuleCall_2_0());
if (current==null) {
current = createModelElement(grammarAccess.getAddRule());
}
setWithLastConsumed(
current,
"file",
lv_file_2_0,
"org.xtext.example.mydsl.MyDsl.ID");
}
}
// InternalMyDsl.g:1082:3: ( (otherlv_3= '?' | otherlv_4= '*' ) | (otherlv_5= '.' this_ID_6= RULE_ID ) )?
int alt14=3;
int LA14_0 = input.LA(1);
if ( ((LA14_0>=25 && LA14_0<=26)) ) {
alt14=1;
}
else if ( (LA14_0==27) ) {
alt14=2;
}
switch (alt14) {
case 1 :
// InternalMyDsl.g:1083:4: (otherlv_3= '?' | otherlv_4= '*' )
{
// InternalMyDsl.g:1083:4: (otherlv_3= '?' | otherlv_4= '*' )
int alt13=2;
int LA13_0 = input.LA(1);
if ( (LA13_0==25) ) {
alt13=1;
}
else if ( (LA13_0==26) ) {
alt13=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 13, 0, input);
throw nvae;
}
switch (alt13) {
case 1 :
// InternalMyDsl.g:1084:5: otherlv_3= '?'
{
otherlv_3=(Token)match(input,25,FOLLOW_8);
newLeafNode(otherlv_3, grammarAccess.getAddAccess().getQuestionMarkKeyword_3_0_0());
}
break;
case 2 :
// InternalMyDsl.g:1089:5: otherlv_4= '*'
{
otherlv_4=(Token)match(input,26,FOLLOW_8);
newLeafNode(otherlv_4, grammarAccess.getAddAccess().getAsteriskKeyword_3_0_1());
}
break;
}
}
break;
case 2 :
// InternalMyDsl.g:1095:4: (otherlv_5= '.' this_ID_6= RULE_ID )
{
// InternalMyDsl.g:1095:4: (otherlv_5= '.' this_ID_6= RULE_ID )
// InternalMyDsl.g:1096:5: otherlv_5= '.' this_ID_6= RULE_ID
{
otherlv_5=(Token)match(input,27,FOLLOW_12);
newLeafNode(otherlv_5, grammarAccess.getAddAccess().getFullStopKeyword_3_1_0());
this_ID_6=(Token)match(input,RULE_ID,FOLLOW_8);
newLeafNode(this_ID_6, grammarAccess.getAddAccess().getIDTerminalRuleCall_3_1_1());
}
}
break;
}
// InternalMyDsl.g:1106:3: ( (lv_directory_7_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:1107:4: (lv_directory_7_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:1107:4: (lv_directory_7_0= RULE_SHELL_CMD )
// InternalMyDsl.g:1108:5: lv_directory_7_0= RULE_SHELL_CMD
{
lv_directory_7_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_directory_7_0, grammarAccess.getAddAccess().getDirectorySHELL_CMDTerminalRuleCall_4_0());
if (current==null) {
current = createModelElement(grammarAccess.getAddRule());
}
setWithLastConsumed(
current,
"directory",
lv_directory_7_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleAdd"
// $ANTLR start "entryRuleCopy"
// InternalMyDsl.g:1128:1: entryRuleCopy returns [EObject current=null] : iv_ruleCopy= ruleCopy EOF ;
public final EObject entryRuleCopy() throws RecognitionException {
EObject current = null;
EObject iv_ruleCopy = null;
try {
// InternalMyDsl.g:1128:45: (iv_ruleCopy= ruleCopy EOF )
// InternalMyDsl.g:1129:2: iv_ruleCopy= ruleCopy EOF
{
newCompositeNode(grammarAccess.getCopyRule());
pushFollow(FOLLOW_1);
iv_ruleCopy=ruleCopy();
state._fsp--;
current =iv_ruleCopy;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleCopy"
// $ANTLR start "ruleCopy"
// InternalMyDsl.g:1135:1: ruleCopy returns [EObject current=null] : ( ( (lv_key_0_0= 'COPY ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) (otherlv_3= '?' | otherlv_4= '*' )? (otherlv_5= '.' this_ID_6= RULE_ID )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) ) ;
public final EObject ruleCopy() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
Token lv_chown_options_1_0=null;
Token lv_file_2_0=null;
Token otherlv_3=null;
Token otherlv_4=null;
Token otherlv_5=null;
Token this_ID_6=null;
Token lv_directory_7_0=null;
enterRule();
try {
// InternalMyDsl.g:1141:2: ( ( ( (lv_key_0_0= 'COPY ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) (otherlv_3= '?' | otherlv_4= '*' )? (otherlv_5= '.' this_ID_6= RULE_ID )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) ) )
// InternalMyDsl.g:1142:2: ( ( (lv_key_0_0= 'COPY ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) (otherlv_3= '?' | otherlv_4= '*' )? (otherlv_5= '.' this_ID_6= RULE_ID )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) )
{
// InternalMyDsl.g:1142:2: ( ( (lv_key_0_0= 'COPY ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) (otherlv_3= '?' | otherlv_4= '*' )? (otherlv_5= '.' this_ID_6= RULE_ID )? ( (lv_directory_7_0= RULE_SHELL_CMD ) ) )
// InternalMyDsl.g:1143:3: ( (lv_key_0_0= 'COPY ' ) ) ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )? ( (lv_file_2_0= RULE_ID ) ) (otherlv_3= '?' | otherlv_4= '*' )? (otherlv_5= '.' this_ID_6= RULE_ID )? ( (lv_directory_7_0= RULE_SHELL_CMD ) )
{
// InternalMyDsl.g:1143:3: ( (lv_key_0_0= 'COPY ' ) )
// InternalMyDsl.g:1144:4: (lv_key_0_0= 'COPY ' )
{
// InternalMyDsl.g:1144:4: (lv_key_0_0= 'COPY ' )
// InternalMyDsl.g:1145:5: lv_key_0_0= 'COPY '
{
lv_key_0_0=(Token)match(input,28,FOLLOW_11);
newLeafNode(lv_key_0_0, grammarAccess.getCopyAccess().getKeyCOPYKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getCopyRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "COPY ");
}
}
// InternalMyDsl.g:1157:3: ( (lv_chown_options_1_0= RULE_CHOWN_OPTION ) )?
int alt15=2;
int LA15_0 = input.LA(1);
if ( (LA15_0==RULE_CHOWN_OPTION) ) {
alt15=1;
}
switch (alt15) {
case 1 :
// InternalMyDsl.g:1158:4: (lv_chown_options_1_0= RULE_CHOWN_OPTION )
{
// InternalMyDsl.g:1158:4: (lv_chown_options_1_0= RULE_CHOWN_OPTION )
// InternalMyDsl.g:1159:5: lv_chown_options_1_0= RULE_CHOWN_OPTION
{
lv_chown_options_1_0=(Token)match(input,RULE_CHOWN_OPTION,FOLLOW_12);
newLeafNode(lv_chown_options_1_0, grammarAccess.getCopyAccess().getChown_optionsCHOWN_OPTIONTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getCopyRule());
}
setWithLastConsumed(
current,
"chown_options",
lv_chown_options_1_0,
"org.xtext.example.mydsl.MyDsl.CHOWN_OPTION");
}
}
break;
}
// InternalMyDsl.g:1175:3: ( (lv_file_2_0= RULE_ID ) )
// InternalMyDsl.g:1176:4: (lv_file_2_0= RULE_ID )
{
// InternalMyDsl.g:1176:4: (lv_file_2_0= RULE_ID )
// InternalMyDsl.g:1177:5: lv_file_2_0= RULE_ID
{
lv_file_2_0=(Token)match(input,RULE_ID,FOLLOW_13);
newLeafNode(lv_file_2_0, grammarAccess.getCopyAccess().getFileIDTerminalRuleCall_2_0());
if (current==null) {
current = createModelElement(grammarAccess.getCopyRule());
}
setWithLastConsumed(
current,
"file",
lv_file_2_0,
"org.xtext.example.mydsl.MyDsl.ID");
}
}
// InternalMyDsl.g:1193:3: (otherlv_3= '?' | otherlv_4= '*' )?
int alt16=3;
int LA16_0 = input.LA(1);
if ( (LA16_0==25) ) {
alt16=1;
}
else if ( (LA16_0==26) ) {
alt16=2;
}
switch (alt16) {
case 1 :
// InternalMyDsl.g:1194:4: otherlv_3= '?'
{
otherlv_3=(Token)match(input,25,FOLLOW_14);
newLeafNode(otherlv_3, grammarAccess.getCopyAccess().getQuestionMarkKeyword_3_0());
}
break;
case 2 :
// InternalMyDsl.g:1199:4: otherlv_4= '*'
{
otherlv_4=(Token)match(input,26,FOLLOW_14);
newLeafNode(otherlv_4, grammarAccess.getCopyAccess().getAsteriskKeyword_3_1());
}
break;
}
// InternalMyDsl.g:1204:3: (otherlv_5= '.' this_ID_6= RULE_ID )?
int alt17=2;
int LA17_0 = input.LA(1);
if ( (LA17_0==27) ) {
alt17=1;
}
switch (alt17) {
case 1 :
// InternalMyDsl.g:1205:4: otherlv_5= '.' this_ID_6= RULE_ID
{
otherlv_5=(Token)match(input,27,FOLLOW_12);
newLeafNode(otherlv_5, grammarAccess.getCopyAccess().getFullStopKeyword_4_0());
this_ID_6=(Token)match(input,RULE_ID,FOLLOW_8);
newLeafNode(this_ID_6, grammarAccess.getCopyAccess().getIDTerminalRuleCall_4_1());
}
break;
}
// InternalMyDsl.g:1214:3: ( (lv_directory_7_0= RULE_SHELL_CMD ) )
// InternalMyDsl.g:1215:4: (lv_directory_7_0= RULE_SHELL_CMD )
{
// InternalMyDsl.g:1215:4: (lv_directory_7_0= RULE_SHELL_CMD )
// InternalMyDsl.g:1216:5: lv_directory_7_0= RULE_SHELL_CMD
{
lv_directory_7_0=(Token)match(input,RULE_SHELL_CMD,FOLLOW_2);
newLeafNode(lv_directory_7_0, grammarAccess.getCopyAccess().getDirectorySHELL_CMDTerminalRuleCall_5_0());
if (current==null) {
current = createModelElement(grammarAccess.getCopyRule());
}
setWithLastConsumed(
current,
"directory",
lv_directory_7_0,
"org.xtext.example.mydsl.MyDsl.SHELL_CMD");
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleCopy"
// $ANTLR start "entryRuleOnbuild"
// InternalMyDsl.g:1236:1: entryRuleOnbuild returns [EObject current=null] : iv_ruleOnbuild= ruleOnbuild EOF ;
public final EObject entryRuleOnbuild() throws RecognitionException {
EObject current = null;
EObject iv_ruleOnbuild = null;
try {
// InternalMyDsl.g:1236:48: (iv_ruleOnbuild= ruleOnbuild EOF )
// InternalMyDsl.g:1237:2: iv_ruleOnbuild= ruleOnbuild EOF
{
newCompositeNode(grammarAccess.getOnbuildRule());
pushFollow(FOLLOW_1);
iv_ruleOnbuild=ruleOnbuild();
state._fsp--;
current =iv_ruleOnbuild;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleOnbuild"
// $ANTLR start "ruleOnbuild"
// InternalMyDsl.g:1243:1: ruleOnbuild returns [EObject current=null] : ( ( (lv_key_0_0= 'ONBUILD ' ) ) ( (lv_statement_1_0= ruleInstruction ) ) ) ;
public final EObject ruleOnbuild() throws RecognitionException {
EObject current = null;
Token lv_key_0_0=null;
EObject lv_statement_1_0 = null;
enterRule();
try {
// InternalMyDsl.g:1249:2: ( ( ( (lv_key_0_0= 'ONBUILD ' ) ) ( (lv_statement_1_0= ruleInstruction ) ) ) )
// InternalMyDsl.g:1250:2: ( ( (lv_key_0_0= 'ONBUILD ' ) ) ( (lv_statement_1_0= ruleInstruction ) ) )
{
// InternalMyDsl.g:1250:2: ( ( (lv_key_0_0= 'ONBUILD ' ) ) ( (lv_statement_1_0= ruleInstruction ) ) )
// InternalMyDsl.g:1251:3: ( (lv_key_0_0= 'ONBUILD ' ) ) ( (lv_statement_1_0= ruleInstruction ) )
{
// InternalMyDsl.g:1251:3: ( (lv_key_0_0= 'ONBUILD ' ) )
// InternalMyDsl.g:1252:4: (lv_key_0_0= 'ONBUILD ' )
{
// InternalMyDsl.g:1252:4: (lv_key_0_0= 'ONBUILD ' )
// InternalMyDsl.g:1253:5: lv_key_0_0= 'ONBUILD '
{
lv_key_0_0=(Token)match(input,29,FOLLOW_15);
newLeafNode(lv_key_0_0, grammarAccess.getOnbuildAccess().getKeyONBUILDKeyword_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getOnbuildRule());
}
setWithLastConsumed(current, "key", lv_key_0_0, "ONBUILD ");
}
}
// InternalMyDsl.g:1265:3: ( (lv_statement_1_0= ruleInstruction ) )
// InternalMyDsl.g:1266:4: (lv_statement_1_0= ruleInstruction )
{
// InternalMyDsl.g:1266:4: (lv_statement_1_0= ruleInstruction )
// InternalMyDsl.g:1267:5: lv_statement_1_0= ruleInstruction
{
newCompositeNode(grammarAccess.getOnbuildAccess().getStatementInstructionParserRuleCall_1_0());
pushFollow(FOLLOW_2);
lv_statement_1_0=ruleInstruction();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getOnbuildRule());
}
set(
current,
"statement",
lv_statement_1_0,
"org.xtext.example.mydsl.MyDsl.Instruction");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleOnbuild"
// $ANTLR start "entryRuleIMAGE_NAME"
// InternalMyDsl.g:1288:1: entryRuleIMAGE_NAME returns [String current=null] : iv_ruleIMAGE_NAME= ruleIMAGE_NAME EOF ;
public final String entryRuleIMAGE_NAME() throws RecognitionException {
String current = null;
AntlrDatatypeRuleToken iv_ruleIMAGE_NAME = null;
try {
// InternalMyDsl.g:1288:50: (iv_ruleIMAGE_NAME= ruleIMAGE_NAME EOF )
// InternalMyDsl.g:1289:2: iv_ruleIMAGE_NAME= ruleIMAGE_NAME EOF
{
newCompositeNode(grammarAccess.getIMAGE_NAMERule());
pushFollow(FOLLOW_1);
iv_ruleIMAGE_NAME=ruleIMAGE_NAME();
state._fsp--;
current =iv_ruleIMAGE_NAME.getText();
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleIMAGE_NAME"
// $ANTLR start "ruleIMAGE_NAME"
// InternalMyDsl.g:1295:1: ruleIMAGE_NAME returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (this_ID_0= RULE_ID (kw= '/' this_ID_2= RULE_ID )* ) ;
public final AntlrDatatypeRuleToken ruleIMAGE_NAME() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token this_ID_0=null;
Token kw=null;
Token this_ID_2=null;
enterRule();
try {
// InternalMyDsl.g:1301:2: ( (this_ID_0= RULE_ID (kw= '/' this_ID_2= RULE_ID )* ) )
// InternalMyDsl.g:1302:2: (this_ID_0= RULE_ID (kw= '/' this_ID_2= RULE_ID )* )
{
// InternalMyDsl.g:1302:2: (this_ID_0= RULE_ID (kw= '/' this_ID_2= RULE_ID )* )
// InternalMyDsl.g:1303:3: this_ID_0= RULE_ID (kw= '/' this_ID_2= RULE_ID )*
{
this_ID_0=(Token)match(input,RULE_ID,FOLLOW_16);
current.merge(this_ID_0);
newLeafNode(this_ID_0, grammarAccess.getIMAGE_NAMEAccess().getIDTerminalRuleCall_0());
// InternalMyDsl.g:1310:3: (kw= '/' this_ID_2= RULE_ID )*
loop18:
do {
int alt18=2;
int LA18_0 = input.LA(1);
if ( (LA18_0==30) ) {
alt18=1;
}
switch (alt18) {
case 1 :
// InternalMyDsl.g:1311:4: kw= '/' this_ID_2= RULE_ID
{
kw=(Token)match(input,30,FOLLOW_12);
current.merge(kw);
newLeafNode(kw, grammarAccess.getIMAGE_NAMEAccess().getSolidusKeyword_1_0());
this_ID_2=(Token)match(input,RULE_ID,FOLLOW_16);
current.merge(this_ID_2);
newLeafNode(this_ID_2, grammarAccess.getIMAGE_NAMEAccess().getIDTerminalRuleCall_1_1());
}
break;
default :
break loop18;
}
} while (true);
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleIMAGE_NAME"
// $ANTLR start "entryRuleIMAGE_TAG"
// InternalMyDsl.g:1328:1: entryRuleIMAGE_TAG returns [String current=null] : iv_ruleIMAGE_TAG= ruleIMAGE_TAG EOF ;
public final String entryRuleIMAGE_TAG() throws RecognitionException {
String current = null;
AntlrDatatypeRuleToken iv_ruleIMAGE_TAG = null;
try {
// InternalMyDsl.g:1328:49: (iv_ruleIMAGE_TAG= ruleIMAGE_TAG EOF )
// InternalMyDsl.g:1329:2: iv_ruleIMAGE_TAG= ruleIMAGE_TAG EOF
{
newCompositeNode(grammarAccess.getIMAGE_TAGRule());
pushFollow(FOLLOW_1);
iv_ruleIMAGE_TAG=ruleIMAGE_TAG();
state._fsp--;
current =iv_ruleIMAGE_TAG.getText();
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleIMAGE_TAG"
// $ANTLR start "ruleIMAGE_TAG"
// InternalMyDsl.g:1335:1: ruleIMAGE_TAG returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (kw= ':' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* ) ;
public final AntlrDatatypeRuleToken ruleIMAGE_TAG() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
Token this_ID_1=null;
Token this_INT_2=null;
Token this_STRING_3=null;
Token this_ID_4=null;
Token this_INT_5=null;
Token this_STRING_6=null;
enterRule();
try {
// InternalMyDsl.g:1341:2: ( (kw= ':' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* ) )
// InternalMyDsl.g:1342:2: (kw= ':' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* )
{
// InternalMyDsl.g:1342:2: (kw= ':' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* )
// InternalMyDsl.g:1343:3: kw= ':' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )*
{
kw=(Token)match(input,31,FOLLOW_17);
current.merge(kw);
newLeafNode(kw, grammarAccess.getIMAGE_TAGAccess().getColonKeyword_0());
// InternalMyDsl.g:1348:3: (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING )
int alt19=3;
switch ( input.LA(1) ) {
case RULE_ID:
{
alt19=1;
}
break;
case RULE_INT:
{
alt19=2;
}
break;
case RULE_STRING:
{
alt19=3;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 19, 0, input);
throw nvae;
}
switch (alt19) {
case 1 :
// InternalMyDsl.g:1349:4: this_ID_1= RULE_ID
{
this_ID_1=(Token)match(input,RULE_ID,FOLLOW_18);
current.merge(this_ID_1);
newLeafNode(this_ID_1, grammarAccess.getIMAGE_TAGAccess().getIDTerminalRuleCall_1_0());
}
break;
case 2 :
// InternalMyDsl.g:1357:4: this_INT_2= RULE_INT
{
this_INT_2=(Token)match(input,RULE_INT,FOLLOW_18);
current.merge(this_INT_2);
newLeafNode(this_INT_2, grammarAccess.getIMAGE_TAGAccess().getINTTerminalRuleCall_1_1());
}
break;
case 3 :
// InternalMyDsl.g:1365:4: this_STRING_3= RULE_STRING
{
this_STRING_3=(Token)match(input,RULE_STRING,FOLLOW_18);
current.merge(this_STRING_3);
newLeafNode(this_STRING_3, grammarAccess.getIMAGE_TAGAccess().getSTRINGTerminalRuleCall_1_2());
}
break;
}
// InternalMyDsl.g:1373:3: (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )*
loop20:
do {
int alt20=6;
switch ( input.LA(1) ) {
case RULE_ID:
{
alt20=1;
}
break;
case RULE_INT:
{
alt20=2;
}
break;
case RULE_STRING:
{
alt20=3;
}
break;
case 32:
{
alt20=4;
}
break;
case 27:
{
alt20=5;
}
break;
}
switch (alt20) {
case 1 :
// InternalMyDsl.g:1374:4: this_ID_4= RULE_ID
{
this_ID_4=(Token)match(input,RULE_ID,FOLLOW_18);
current.merge(this_ID_4);
newLeafNode(this_ID_4, grammarAccess.getIMAGE_TAGAccess().getIDTerminalRuleCall_2_0());
}
break;
case 2 :
// InternalMyDsl.g:1382:4: this_INT_5= RULE_INT
{
this_INT_5=(Token)match(input,RULE_INT,FOLLOW_18);
current.merge(this_INT_5);
newLeafNode(this_INT_5, grammarAccess.getIMAGE_TAGAccess().getINTTerminalRuleCall_2_1());
}
break;
case 3 :
// InternalMyDsl.g:1390:4: this_STRING_6= RULE_STRING
{
this_STRING_6=(Token)match(input,RULE_STRING,FOLLOW_18);
current.merge(this_STRING_6);
newLeafNode(this_STRING_6, grammarAccess.getIMAGE_TAGAccess().getSTRINGTerminalRuleCall_2_2());
}
break;
case 4 :
// InternalMyDsl.g:1398:4: kw= '-'
{
kw=(Token)match(input,32,FOLLOW_18);
current.merge(kw);
newLeafNode(kw, grammarAccess.getIMAGE_TAGAccess().getHyphenMinusKeyword_2_3());
}
break;
case 5 :
// InternalMyDsl.g:1404:4: kw= '.'
{
kw=(Token)match(input,27,FOLLOW_18);
current.merge(kw);
newLeafNode(kw, grammarAccess.getIMAGE_TAGAccess().getFullStopKeyword_2_4());
}
break;
default :
break loop20;
}
} while (true);
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleIMAGE_TAG"
// $ANTLR start "entryRuleIMAGE_DIGEST"
// InternalMyDsl.g:1414:1: entryRuleIMAGE_DIGEST returns [String current=null] : iv_ruleIMAGE_DIGEST= ruleIMAGE_DIGEST EOF ;
public final String entryRuleIMAGE_DIGEST() throws RecognitionException {
String current = null;
AntlrDatatypeRuleToken iv_ruleIMAGE_DIGEST = null;
try {
// InternalMyDsl.g:1414:52: (iv_ruleIMAGE_DIGEST= ruleIMAGE_DIGEST EOF )
// InternalMyDsl.g:1415:2: iv_ruleIMAGE_DIGEST= ruleIMAGE_DIGEST EOF
{
newCompositeNode(grammarAccess.getIMAGE_DIGESTRule());
pushFollow(FOLLOW_1);
iv_ruleIMAGE_DIGEST=ruleIMAGE_DIGEST();
state._fsp--;
current =iv_ruleIMAGE_DIGEST.getText();
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleIMAGE_DIGEST"
// $ANTLR start "ruleIMAGE_DIGEST"
// InternalMyDsl.g:1421:1: ruleIMAGE_DIGEST returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (kw= '@' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* ) ;
public final AntlrDatatypeRuleToken ruleIMAGE_DIGEST() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
Token this_ID_1=null;
Token this_INT_2=null;
Token this_STRING_3=null;
Token this_ID_4=null;
Token this_INT_5=null;
Token this_STRING_6=null;
enterRule();
try {
// InternalMyDsl.g:1427:2: ( (kw= '@' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* ) )
// InternalMyDsl.g:1428:2: (kw= '@' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* )
{
// InternalMyDsl.g:1428:2: (kw= '@' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )* )
// InternalMyDsl.g:1429:3: kw= '@' (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING ) (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )*
{
kw=(Token)match(input,33,FOLLOW_17);
current.merge(kw);
newLeafNode(kw, grammarAccess.getIMAGE_DIGESTAccess().getCommercialAtKeyword_0());
// InternalMyDsl.g:1434:3: (this_ID_1= RULE_ID | this_INT_2= RULE_INT | this_STRING_3= RULE_STRING )
int alt21=3;
switch ( input.LA(1) ) {
case RULE_ID:
{
alt21=1;
}
break;
case RULE_INT:
{
alt21=2;
}
break;
case RULE_STRING:
{
alt21=3;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 21, 0, input);
throw nvae;
}
switch (alt21) {
case 1 :
// InternalMyDsl.g:1435:4: this_ID_1= RULE_ID
{
this_ID_1=(Token)match(input,RULE_ID,FOLLOW_18);
current.merge(this_ID_1);
newLeafNode(this_ID_1, grammarAccess.getIMAGE_DIGESTAccess().getIDTerminalRuleCall_1_0());
}
break;
case 2 :
// InternalMyDsl.g:1443:4: this_INT_2= RULE_INT
{
this_INT_2=(Token)match(input,RULE_INT,FOLLOW_18);
current.merge(this_INT_2);
newLeafNode(this_INT_2, grammarAccess.getIMAGE_DIGESTAccess().getINTTerminalRuleCall_1_1());
}
break;
case 3 :
// InternalMyDsl.g:1451:4: this_STRING_3= RULE_STRING
{
this_STRING_3=(Token)match(input,RULE_STRING,FOLLOW_18);
current.merge(this_STRING_3);
newLeafNode(this_STRING_3, grammarAccess.getIMAGE_DIGESTAccess().getSTRINGTerminalRuleCall_1_2());
}
break;
}
// InternalMyDsl.g:1459:3: (this_ID_4= RULE_ID | this_INT_5= RULE_INT | this_STRING_6= RULE_STRING | kw= '-' | kw= '.' )*
loop22:
do {
int alt22=6;
switch ( input.LA(1) ) {
case RULE_ID:
{
alt22=1;
}
break;
case RULE_INT:
{
alt22=2;
}
break;
case RULE_STRING:
{
alt22=3;
}
break;
case 32:
{
alt22=4;
}
break;
case 27:
{
alt22=5;
}
break;
}
switch (alt22) {
case 1 :
// InternalMyDsl.g:1460:4: this_ID_4= RULE_ID
{
this_ID_4=(Token)match(input,RULE_ID,FOLLOW_18);
current.merge(this_ID_4);
newLeafNode(this_ID_4, grammarAccess.getIMAGE_DIGESTAccess().getIDTerminalRuleCall_2_0());
}
break;
case 2 :
// InternalMyDsl.g:1468:4: this_INT_5= RULE_INT
{
this_INT_5=(Token)match(input,RULE_INT,FOLLOW_18);
current.merge(this_INT_5);
newLeafNode(this_INT_5, grammarAccess.getIMAGE_DIGESTAccess().getINTTerminalRuleCall_2_1());
}
break;
case 3 :
// InternalMyDsl.g:1476:4: this_STRING_6= RULE_STRING
{
this_STRING_6=(Token)match(input,RULE_STRING,FOLLOW_18);
current.merge(this_STRING_6);
newLeafNode(this_STRING_6, grammarAccess.getIMAGE_DIGESTAccess().getSTRINGTerminalRuleCall_2_2());
}
break;
case 4 :
// InternalMyDsl.g:1484:4: kw= '-'
{
kw=(Token)match(input,32,FOLLOW_18);
current.merge(kw);
newLeafNode(kw, grammarAccess.getIMAGE_DIGESTAccess().getHyphenMinusKeyword_2_3());
}
break;
case 5 :
// InternalMyDsl.g:1490:4: kw= '.'
{
kw=(Token)match(input,27,FOLLOW_18);
current.merge(kw);
newLeafNode(kw, grammarAccess.getIMAGE_DIGESTAccess().getFullStopKeyword_2_4());
}
break;
default :
break loop22;
}
} while (true);
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleIMAGE_DIGEST"
// $ANTLR start "entryRuleEXEC_FORM"
// InternalMyDsl.g:1500:1: entryRuleEXEC_FORM returns [EObject current=null] : iv_ruleEXEC_FORM= ruleEXEC_FORM EOF ;
public final EObject entryRuleEXEC_FORM() throws RecognitionException {
EObject current = null;
EObject iv_ruleEXEC_FORM = null;
try {
// InternalMyDsl.g:1500:50: (iv_ruleEXEC_FORM= ruleEXEC_FORM EOF )
// InternalMyDsl.g:1501:2: iv_ruleEXEC_FORM= ruleEXEC_FORM EOF
{
newCompositeNode(grammarAccess.getEXEC_FORMRule());
pushFollow(FOLLOW_1);
iv_ruleEXEC_FORM=ruleEXEC_FORM();
state._fsp--;
current =iv_ruleEXEC_FORM;
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "entryRuleEXEC_FORM"
// $ANTLR start "ruleEXEC_FORM"
// InternalMyDsl.g:1507:1: ruleEXEC_FORM returns [EObject current=null] : (otherlv_0= ' [' ( (lv_executable_1_0= RULE_STRING ) ) ( (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER ) )* otherlv_3= ']' ) ;
public final EObject ruleEXEC_FORM() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token lv_executable_1_0=null;
Token lv_parameters_2_0=null;
Token otherlv_3=null;
enterRule();
try {
// InternalMyDsl.g:1513:2: ( (otherlv_0= ' [' ( (lv_executable_1_0= RULE_STRING ) ) ( (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER ) )* otherlv_3= ']' ) )
// InternalMyDsl.g:1514:2: (otherlv_0= ' [' ( (lv_executable_1_0= RULE_STRING ) ) ( (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER ) )* otherlv_3= ']' )
{
// InternalMyDsl.g:1514:2: (otherlv_0= ' [' ( (lv_executable_1_0= RULE_STRING ) ) ( (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER ) )* otherlv_3= ']' )
// InternalMyDsl.g:1515:3: otherlv_0= ' [' ( (lv_executable_1_0= RULE_STRING ) ) ( (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER ) )* otherlv_3= ']'
{
otherlv_0=(Token)match(input,34,FOLLOW_19);
newLeafNode(otherlv_0, grammarAccess.getEXEC_FORMAccess().getSpaceLeftSquareBracketKeyword_0());
// InternalMyDsl.g:1519:3: ( (lv_executable_1_0= RULE_STRING ) )
// InternalMyDsl.g:1520:4: (lv_executable_1_0= RULE_STRING )
{
// InternalMyDsl.g:1520:4: (lv_executable_1_0= RULE_STRING )
// InternalMyDsl.g:1521:5: lv_executable_1_0= RULE_STRING
{
lv_executable_1_0=(Token)match(input,RULE_STRING,FOLLOW_20);
newLeafNode(lv_executable_1_0, grammarAccess.getEXEC_FORMAccess().getExecutableSTRINGTerminalRuleCall_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getEXEC_FORMRule());
}
setWithLastConsumed(
current,
"executable",
lv_executable_1_0,
"org.xtext.example.mydsl.MyDsl.STRING");
}
}
// InternalMyDsl.g:1537:3: ( (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER ) )*
loop23:
do {
int alt23=2;
int LA23_0 = input.LA(1);
if ( (LA23_0==RULE_EXEC_FORM_PARAMETER) ) {
alt23=1;
}
switch (alt23) {
case 1 :
// InternalMyDsl.g:1538:4: (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER )
{
// InternalMyDsl.g:1538:4: (lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER )
// InternalMyDsl.g:1539:5: lv_parameters_2_0= RULE_EXEC_FORM_PARAMETER
{
lv_parameters_2_0=(Token)match(input,RULE_EXEC_FORM_PARAMETER,FOLLOW_20);
newLeafNode(lv_parameters_2_0, grammarAccess.getEXEC_FORMAccess().getParametersEXEC_FORM_PARAMETERTerminalRuleCall_2_0());
if (current==null) {
current = createModelElement(grammarAccess.getEXEC_FORMRule());
}
addWithLastConsumed(
current,
"parameters",
lv_parameters_2_0,
"org.xtext.example.mydsl.MyDsl.EXEC_FORM_PARAMETER");
}
}
break;
default :
break loop23;
}
} while (true);
otherlv_3=(Token)match(input,35,FOLLOW_2);
newLeafNode(otherlv_3, grammarAccess.getEXEC_FORMAccess().getRightSquareBracketKeyword_3());
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
// $ANTLR end "ruleEXEC_FORM"
// Delegated rules
public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000010L});
public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000031FFC022L});
public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000000440L});
public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000280000002L});
public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x0000000400000080L});
public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000000080L});
public static final BitSet FOLLOW_9 = new BitSet(new long[]{0x0000000000000100L});
public static final BitSet FOLLOW_10 = new BitSet(new long[]{0x0000000000000102L});
public static final BitSet FOLLOW_11 = new BitSet(new long[]{0x0000000000000600L});
public static final BitSet FOLLOW_12 = new BitSet(new long[]{0x0000000000000400L});
public static final BitSet FOLLOW_13 = new BitSet(new long[]{0x000000000E000080L});
public static final BitSet FOLLOW_14 = new BitSet(new long[]{0x0000000008000080L});
public static final BitSet FOLLOW_15 = new BitSet(new long[]{0x0000000031FFC000L});
public static final BitSet FOLLOW_16 = new BitSet(new long[]{0x0000000040000002L});
public static final BitSet FOLLOW_17 = new BitSet(new long[]{0x0000000000001C00L});
public static final BitSet FOLLOW_18 = new BitSet(new long[]{0x0000000108001C02L});
public static final BitSet FOLLOW_19 = new BitSet(new long[]{0x0000000000001000L});
public static final BitSet FOLLOW_20 = new BitSet(new long[]{0x0000000800002000L});
} |
package de.trispeedys.resourceplanning.execution;
public class BpmVariables
{
public class RequestHelpHelper
{
public static final String VAR_SUPERVISION_REQUIRED = "supervisionRequired";
// public static final String VAR_HELPER_CODE = "helperCode";
public static final String VAR_HELPER_ID = "helperId";
public static final String VAR_HELPER_CALLBACK = "helperCallback";
public static final String VAR_EVENT_ID = "eventId";
public static final String VAR_PRIOR_POS_AVAILABLE = "priorPosAvailable";
public static final String VAR_CHOSEN_POS_AVAILABLE = "chosenPosAvailable";
public static final String VAR_ACTIVE_HELPER_IDS = "activeHelperIds";
public static final String VAR_ACTIVE_HELPER_ID = "activeHelperId";
public static final String VAR_MAIL_ATTEMPTS = "mailAttempts";
public static final String VAR_CHOSEN_POSITION = "chosenPosition";
// The position which the helper was assigned to the last time
public static final String VAR_PRIOR_POSITION = "priorPosition";
// Sind dem Helfer momentan Positionen vorschlagbar (ja/nein)
public static final String VAR_POSITIONS_PROPOSABLE = "positionsProposable";
public static final String VAR_POS_CHOOSING_REENTRANT = "posChoosingReentrant";
}
} |
package se.xperjon.model;
public class Personal {
private int personalId;
private String namn;
private String befattning;
private Avdelning avdelning;
public int getPersonalId() {
return personalId;
}
public void setPersonalId(int personalId) {
this.personalId = personalId;
}
public String getNamn() {
return namn;
}
public void setNamn(String namn) {
this.namn = namn;
}
public String getBefattning() {
return befattning;
}
public void setBefattning(String befattning) {
this.befattning = befattning;
}
public Avdelning getAvdelning() {
return avdelning;
}
public void setAvdelning(Avdelning avdelning) {
this.avdelning = avdelning;
}
@Override
public String toString() {
return "Personal [personalId=" + personalId + ", namn=" + namn + ", befattning=" + befattning + ", avdelning="
+ avdelning + "]";
}
}
|
package com.example.android.beatmymovies;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by Admin on 05-01-2016.
*/
public class Trailor implements Parcelable{
public String name;
public String id;
public String key;
public Trailor(String s1, String s2,String s3){
this.name = s1;
this.id = s2;
this.key = s3;
}
protected Trailor(Parcel in) {
name = in.readString();
id = in.readString();
key = in.readString();
}
public static final Parcelable.Creator<Trailor> CREATOR = new Parcelable.Creator<Trailor>() {
@Override
public Trailor createFromParcel(Parcel in) {
return new Trailor(in);
}
@Override
public Trailor[] newArray(int size) {
return new Trailor[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeString(id);
dest.writeString(key);
}
}
|
/**
* MIT License
* <p>
* Copyright (c) 2019-2022 nerve.network
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package network.nerve.converter.rpc.call;
import io.nuls.base.basic.AddressTool;
import io.nuls.core.exception.NulsException;
import io.nuls.core.rpc.info.Constants;
import io.nuls.core.rpc.model.ModuleE;
import network.nerve.converter.config.ConverterContext;
import network.nerve.converter.constant.ConverterConstant;
import network.nerve.converter.constant.ConverterErrorCode;
import network.nerve.converter.utils.LoggerUtil;
import java.util.HashMap;
import java.util.Map;
/**
* @author: Loki
* @date: 2020-03-02
*/
public class AccountCall extends BaseCall {
public static String signature(int chainId, String address, String password, String data, Map<String, Object> extend) throws NulsException {
try {
Map<String, Object> params = new HashMap<>(ConverterConstant.INIT_CAPACITY_8);
params.put(Constants.VERSION_KEY_STR, ConverterConstant.RPC_VERSION);
params.put(Constants.CHAIN_ID, chainId);
params.put("address", address);
params.put("password", password);
params.put("data", data);
params.put("extend", extend);
HashMap result = (HashMap) requestAndResponse(ModuleE.AC.abbr, "ac_signature", params);
String signatureStr = (String)result.get("signature");
return signatureStr;
} catch (NulsException e) {
LoggerUtil.LOG.error("SignDigest fail - data:{}", data);
throw e;
}
}
public static String getPriKey(String address, String password) throws NulsException {
if (ConverterContext.SIG_MODE == ConverterConstant.SIG_MODE_LOCAL) {
return _getPriKey(address, password);
} else {
return _getPubKey(address, password);
}
}
private static String _getPriKey(String address, String password) throws NulsException {
try {
int chainId = AddressTool.getChainIdByAddress(address);
Map<String, Object> params = new HashMap<>(ConverterConstant.INIT_CAPACITY_8);
params.put(Constants.VERSION_KEY_STR, ConverterConstant.RPC_VERSION);
params.put(Constants.CHAIN_ID, chainId);
params.put("address", address);
params.put("password", password);
HashMap result = (HashMap) requestAndResponse(ModuleE.AC.abbr, "ac_getPriKeyByAddress", params);
String priKey = (String) result.get("priKey");
return priKey;
} catch (NulsException e) {
LoggerUtil.LOG.error("getPriKey fail - address:{}", address);
throw e;
} catch (RuntimeException e) {
LoggerUtil.LOG.error("getPriKey fail - address:{}", address);
LoggerUtil.LOG.error(e);
throw new NulsException(ConverterErrorCode.RPC_REQUEST_FAILD);
}
}
private static String _getPubKey(String address, String password) throws NulsException {
try {
int chainId = AddressTool.getChainIdByAddress(address);
Map<String, Object> params = new HashMap<>(ConverterConstant.INIT_CAPACITY_8);
params.put(Constants.VERSION_KEY_STR, ConverterConstant.RPC_VERSION);
params.put(Constants.CHAIN_ID, chainId);
params.put("address", address);
params.put("password", password);
HashMap result = (HashMap) requestAndResponse(ModuleE.AC.abbr, "ac_getPubKeyByAddress", params);
String pubKey = (String) result.get("pubKey");
return pubKey;
} catch (NulsException e) {
LoggerUtil.LOG.error("getPubKey fail - address:{}", address);
throw e;
} catch (RuntimeException e) {
LoggerUtil.LOG.error("getPubKey fail - address:{}", address);
LoggerUtil.LOG.error(e);
throw new NulsException(ConverterErrorCode.RPC_REQUEST_FAILD);
}
}
}
|
package com.worldchip.bbp.ect.activity;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.media.SoundPool;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.GestureDetector.OnGestureListener;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.worldchip.bbp.ect.R;
import com.worldchip.bbp.ect.db.DataManager;
import com.worldchip.bbp.ect.entity.FindPasswordInfo;
import com.worldchip.bbp.ect.entity.LoginState;
import com.worldchip.bbp.ect.gwwheel.WheelView;
import com.worldchip.bbp.ect.image.utils.ImageLoader;
import com.worldchip.bbp.ect.image.utils.ImageLoader.Type;
import com.worldchip.bbp.ect.util.Configure;
import com.worldchip.bbp.ect.util.HttpCommon;
import com.worldchip.bbp.ect.util.HttpResponseCallBack;
import com.worldchip.bbp.ect.util.HttpUtils;
import com.worldchip.bbp.ect.util.JsonUtils;
import com.worldchip.bbp.ect.util.MD5Util;
import com.worldchip.bbp.ect.util.ResourceManager;
import com.worldchip.bbp.ect.util.Utils;
import com.worldchip.bbp.ect.view.GlobalProgressDialog;
import com.worldchip.bbp.ect.view.RoundImageView;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
/**
* 锟斤拷锟斤拷
*
* @author WGQ 2014-06-11
*/
public class SettingActivity extends Activity implements OnClickListener,
OnGestureListener, HttpResponseCallBack {
private static final int FLING_MIN_DISTANCE = 50;
private static final int FLING_MIN_VELOCITY = 0;
// 图片锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
private RelativeLayout mImageNameSetting_popupWindow;
private PopupWindow mImageNamePopupWindow;
private RoundImageView mNameAndImageBtn;
private ImageView mImageNameClose, mImageNameBig, mIamgeNameSelect;
private EditText mNameValue, mMaleValue, mAgeValue, mBirthValue;
private ImageButton mSettingNameImageSave;
private PopupWindow mEditInformation;
private LinearLayout mBabyYearLayout, mBabyMonthLayout, mBabyRiLayout;
private TextView mBb_nicheng, mBb_shengri, mBb_nicheng_edit,
mBb_shengri_edit, mBb_brithday_year_tv, mBb_brithday_month_tv,
mBb_brithday_ri_tv;
private TextView mBaby_name, mBaby_sex, mBoy_tv, mGirl_tv, mBaby_year,
mBaby_month, mBaby_ri, mBaby_fyear, mBaby_fmonth, mBaby_fri;
private RelativeLayout mSecand_edit_relayout, mFirst_relayout,
mPopuwidow_relayout, mPopuWindow_bg;
private ImageView mBabyTete, mBabyTete_edit, mBaby_edit, mCancel_edit,
mBabyMoren_edite;
private RadioGroup mRaioGroup;
private RadioButton mBoy_radiobtn, mGirl_radiobtn;
private EditText mBaby_editname;
private Button mSave, mYear, mMonth, mRi;
WheelView country;
private SharedPreferences mBabyinfo;
private HashMap<String, String> mHashMap;
private HashMap<Integer, Integer> mSoundMap = null;
// 锟斤拷锟绞憋拷锟斤拷锟斤拷锟�
private ImageView mTimeLayout;
private RelativeLayout mTimeSetting_popupWindow;
private PopupWindow mTimePopupWindow;
private ImageView mSettinggStandbytimeClose, mSettingStandbytimeReduce,
mSettingStandbytimencrease;
private SeekBar mTimeSeekBar;
private TextView mTimeValue;
private float result;
// 系统锟斤拷锟斤拷锟斤拷锟斤拷
private ImageView mSoundLayout;
private RelativeLayout mSoundSetting_popupWindow;
private PopupWindow mSoundPopupWindow;
private ImageView mSoundSoundColse, mSettingSoundReduce,
mImageSettingSound, mSettingSoundIncrease;
private SeekBar mSoundSeekBar;
private AudioManager audioManager;
// 锟斤拷幕锟斤拷锟饺碉拷锟斤拷
private ImageView mBrightnessLayout;
private RelativeLayout mBrightnessSetting_popupWindow;
private PopupWindow mBrightnessPopupWindow;
private ImageView mSettingLightClose, mSettingBrightnessReduce,
mSettingBrightnessIncrease;
private SeekBar mBrightnessSeekBar;
private int mBrightnessVolume;
// 注锟斤拷锟铰�
private PopupWindow mLoginPopuWindow;
private RelativeLayout mRegisterRelativelayout;
private TextView mRegister, mForgetPassWord, mZhangHao_text, mMiMa_text;
private ImageView mLogin, mCanle;
private EditText mZhangHao, mMiMa;
private PopupWindow mExitLoginPopuWindow;
private RelativeLayout mExitLoginRelativelayout;
private TextView mUserName;
private ImageView mExitLogin, mExitCancle, mChangePSWBtn;
// 锟睫革拷锟斤拷锟斤拷
private PopupWindow mXiuGaiPassWordPopuwindow;
private RelativeLayout mXiuGaiPasswordRelativelayout;
private TextView mOldPassword, mNewPassword, mConfrimPassword,
mXiuGaiPassword;
private EditText mOldPassword_edittext, mNewPassword_edittext,
mConfrimPassword_edittext;
private ImageView mXiuGaiPasswordCanle, mXiuGaiPasswordConfrim;
// 锟斤拷锟斤拷锟斤拷锟�
private PopupWindow mForgetPasswordPopuwindow;
private RelativeLayout mForgetPasswordRelativelayout;
private TextView mFindAccountTV, mOr, mPhoneMessageFind, mInputValidationCode;
private EditText mValidateCodeET, mFindAccountET;
private Button mValidateCodeBtn;
private ImageView mForfetPasswordCancle, mForgetPasswordConfrim;
// WIFI
private ImageView mWifi_image;
// 锟斤拷锟斤拷
//private LinearLayout mBluetoothLayout;
//private ImageView mBluetooth_imgage;
// background sound
private ImageView mImageBGSound;
private boolean isOperBGSound = true;
// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
private LinearLayout mSensorLayout;
private ImageView mSensorImage;
private Typeface mTypeface;
// 锟斤拷锟斤拷
private ImageView mSettingBack;
private SoundPool mSoundpool;
private static final int HTTP_REQ_CODE = 100;
private static final int MSG_GET_VERIFICATION_CODE = 101;
private LinearLayout mAccountLL;
private TextView mAccountTV;
private VerificationRefreshTask mRefreshTask;
private int INTERVAL = 60;
private Timer mTimer;
private GlobalProgressDialog mGlobalProgressDialog;
private static final int START_PROGRESS_DIALOG = 1000;
private static final int STOP_PROGRESS_DIALOG = 1001;
private SharedPreferences mPref;
private SharedPreferences.Editor editor;
public static int MODE = Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE;
public static final String PREFER_NAME = "save_account";
private IntentFilter mWifiIntentFilter;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
switch (msg.what) {
case START_PROGRESS_DIALOG:
startProgressDialog();
break;
case STOP_PROGRESS_DIALOG:
stopProgressDialog();
break;
case MSG_GET_VERIFICATION_CODE:
if (INTERVAL > 0) {
INTERVAL--;
mValidateCodeBtn.setBackgroundResource(R.drawable.validate_count_down_text);
if (Utils.getLanguageInfo(getApplicationContext()) == Utils.CH_LANGUAGE_INDEX) {
mValidateCodeBtn.setText(INTERVAL+"秒");
} else {
mValidateCodeBtn.setText(INTERVAL+"S");
}
if (INTERVAL == 60) {
mValidateCodeBtn.setClickable(false);
}
} else {
INTERVAL = 60;
mValidateCodeBtn.setBackgroundResource(Utils.getResourcesId(
MyApplication.getAppContext(), "validatecode_selector", "drawable"));
mValidateCodeBtn.setText("");
mValidateCodeBtn.setClickable(true);
stopVerficationRefreshTimer();
}
break;
case HTTP_REQ_CODE:
if (msg.arg1 == Configure.SUCCESS) {
Bundle data = msg.getData();
if (data != null) {
String httpTag = data.getString("httpTag");
if (httpTag == null)
return;
String results = data.getString("result");
String resultCode = JsonUtils.doParseValueForKey(results, "resultCode");
if (resultCode == null || TextUtils.isEmpty(resultCode)) {
return;
}
if (httpTag.equals(Configure.HTTP_TAG_LOGIN)) {
LoginState loginInfo = JsonUtils.doLoginJson2Bean(results);
Log.d("Wing", "------++++----> " + loginInfo.toString());
handResultMessge(loginInfo.getResultCode(), Configure.HTTP_TAG_LOGIN, loginInfo);
} else if (httpTag.equals(Configure.HTTP_TAG_UPDATE_PASSWORD)) {
handResultMessge(Integer.parseInt(resultCode), Configure.HTTP_TAG_UPDATE_PASSWORD, null);
} else if (httpTag.equals(Configure.HTTP_TAG_GET_VERFICATION_CODE)) {
handResultMessge(Integer.parseInt(resultCode), Configure.HTTP_TAG_GET_VERFICATION_CODE, null);
}else if (httpTag.equals(Configure.HTTP_TAG_GET_OLD_PSW)) {
FindPasswordInfo passwordInfo = JsonUtils.doOriginalPSWJson2Bean(results);
handResultMessge(Integer.parseInt(resultCode), Configure.HTTP_TAG_GET_OLD_PSW, passwordInfo);
}
}
}
break;
default:
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_setting_main);
HttpCommon.hideSystemUI(SettingActivity.this, true);
mBabyinfo = getSharedPreferences("babyinfo", 0);
mSoundpool = new SoundPool(10, AudioManager.STREAM_MUSIC, 5);
mSoundMap = new HashMap<Integer, Integer>();
mSoundMap.put(30, mSoundpool.load(this, R.raw.click, 1));
initView();
mTypeface = Typeface.createFromAsset(getAssets(),
"Droidhuakangbaoti.TTF");
mNameAndImageBtn.setOnClickListener(this);
mTimeLayout.setOnClickListener(this);
mBrightnessLayout.setOnClickListener(this);
mSoundLayout.setOnClickListener(this);
mSettingBack.setOnClickListener(this);
mWifi_image.setOnClickListener(this);
//mBluetooth_imgage.setOnClickListener(this);
mSensorImage.setOnClickListener(this);
mImageBGSound.setOnClickListener(this);
mPref = getSharedPreferences(PREFER_NAME, MODE);
editor = mPref.edit();
}
/**
* 锟截硷拷锟斤拷始锟斤拷
*/
private void initView() {
// 图片锟斤拷锟斤拷锟街帮拷钮
mNameAndImageBtn = (RoundImageView) findViewById(R.id.name_and_image_btn);
if (LoginState.getInstance().isLogin()){
String photoUrl = mBabyinfo.getString(Utils.USER_SHARD_PHOTO_KEY, "");
ImageLoader imageLoader = ImageLoader.getInstance(1, Type.LIFO);
if (photoUrl != null && mNameAndImageBtn != null) {
imageLoader.loadImage(photoUrl, mNameAndImageBtn, true,false);
}
}
mAccountLL = (LinearLayout) findViewById(R.id.account_ll);
mAccountTV = (TextView) findViewById(R.id.account_tv);
findViewById(R.id.account_manager_TV).setSelected(true);
mTimeLayout = (ImageView) findViewById(R.id.stand_by_time_ll);
mImageBGSound = (ImageView) findViewById(R.id.img_bg_sound);
// 锟斤拷锟斤拷锟斤拷锟节帮拷钮
mSoundLayout = (ImageView) findViewById(R.id.sound_ll);
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
// 锟斤拷取锟斤拷前锟斤拷锟斤拷锟斤拷锟斤拷
int volume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
if (volume == 0) {
mSoundLayout.setImageResource(R.drawable.mute);
if (DataManager.getMainIsPlayEffectEnable(MyApplication.getAppContext())) {
DataManager.setMainIsPlayEffectEnable(
MyApplication.getAppContext(), false);
}
} else {
mSoundLayout.setImageResource(R.drawable.sound_on);
if (!(DataManager.getMainIsPlayEffectEnable(MyApplication.getAppContext()))) {
DataManager.setMainIsPlayEffectEnable(
MyApplication.getAppContext(), true);
}
}
// 锟斤拷锟饺碉拷锟节帮拷钮
mBrightnessLayout = (ImageView) findViewById(R.id.brightness_ll);
// WIFI
mWifi_image = (ImageView) findViewById(R.id.wifi_image);
// 锟斤拷始锟斤拷WIFI
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifiManager.isWifiEnabled()) {
mWifi_image.setImageResource(R.drawable.wifi_on);
} else {
mWifi_image.setImageResource(R.drawable.wifi_off);
}
// 锟斤拷锟斤拷
//mBluetoothLayout = (LinearLayout) findViewById(R.id.bluetooth_layout);
//mBluetooth_imgage = (ImageView) findViewById(R.id.bluetooth_imgage);
isOperBGSound = DataManager
.getMainIsPlayBackgroundMusicEnable(MyApplication
.getAppContext());
if (DataManager
.getMainIsPlayEffectEnable(MyApplication.getAppContext())) {
if (isOperBGSound) {
mImageBGSound.setImageResource(R.drawable.btn_music_on_state);
} else {
mImageBGSound.setImageResource(R.drawable.btn_music_off_state);
}
} else {
mImageBGSound.setImageResource(R.drawable.btn_music_off_state);
}
// 锟斤拷始锟斤拷锟斤拷锟斤拷
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter
.getDefaultAdapter();
/*if (mBluetoothAdapter != null) {
if (mBluetoothAdapter.isEnabled()) {
mBluetooth_imgage.setImageResource(R.drawable.bluetooth_on);
} else {
mBluetooth_imgage.setImageResource(R.drawable.bluetooth_off);
}
} else {
mBluetoothLayout.setVisibility(View.INVISIBLE);
} */
// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫帮拷钮
mSensorLayout = (LinearLayout) findViewById(R.id.sensor_layout);
mSensorImage = (ImageView) findViewById(R.id.sensor_image);
// 锟斤拷始锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
// 锟斤拷锟斤拷系统Sensor锟斤拷锟斤拷锟斤拷
//SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
//Sensor sensor_accelerometer = sensorManager
// .getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
SharedPreferences configShard = getSharedPreferences("config", 0);
boolean sensorSwitch = configShard.getBoolean("sensor_switch", false);
if (sensorSwitch) {
mSensorImage.setImageResource(R.drawable.accelerometer_off);
} else {
mSensorImage.setImageResource(R.drawable.accelerometer_on);
}
// 锟斤拷锟斤拷
mSettingBack = (ImageView) findViewById(R.id.setting_back);
//updateAccountView();
}
private void updateAccountView() {
LoginState loginState = LoginState.getInstance();
if (mAccountLL != null && !loginState.isLogin()) {
mAccountLL.setVisibility(View.GONE);
} else {
if (mAccountTV != null) {
mAccountTV.setText(loginState.getAccount());
mAccountLL.setVisibility(View.VISIBLE);
}
}
}
/**
* 锟斤拷示锟斤拷锟绞憋拷锟斤拷锟斤拷么锟斤拷锟�
*/
private void showTimePopupWindow() {
if (mTimePopupWindow != null) {
mTimePopupWindow.dismiss();
mTimePopupWindow = null;
}
mTimeSetting_popupWindow = (RelativeLayout) LayoutInflater.from(
SettingActivity.this).inflate(
R.layout.activity_setting_time_item, null);
// 锟斤拷锟矫斤拷锟斤拷示锟侥达拷锟节的匡拷锟街碉拷锟轿拷锟侥伙拷锟斤拷值锟斤拷50%
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = 615;// 锟斤拷锟�
int height = 528;// 锟竭讹拷
mTimePopupWindow = new PopupWindow(SettingActivity.this);
mTimePopupWindow.setBackgroundDrawable(new ColorDrawable(0));
mTimePopupWindow.setWidth(width);
mTimePopupWindow.setHeight(height);
mTimePopupWindow.setOutsideTouchable(false);
mTimePopupWindow.setFocusable(true);
mTimePopupWindow.setContentView(mTimeSetting_popupWindow);
mTimePopupWindow.showAtLocation(findViewById(R.id.setting_main),
Gravity.CENTER, 0, 0);// 锟斤拷示锟斤拷位锟斤拷为:锟斤拷锟斤拷诟锟斤拷丶锟斤拷锟斤拷锟�
mSettinggStandbytimeClose = (ImageView) mTimeSetting_popupWindow
.findViewById(R.id.settingg_standbytime_close);
// 锟斤拷锟斤拷
mSettingStandbytimeReduce = (ImageView) mTimeSetting_popupWindow
.findViewById(R.id.setting_standbytime_reduce);
// 锟接猴拷
mSettingStandbytimencrease = (ImageView) mTimeSetting_popupWindow
.findViewById(R.id.setting_standbytime_increase);
mTimeSeekBar = (SeekBar) mTimeSetting_popupWindow
.findViewById(R.id.timeSeekBar);
mTimeValue = (TextView) mTimeSetting_popupWindow
.findViewById(R.id.timeValue);
//mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),"setting_standbytime_selection_box", "drawable"));
// 锟斤拷取锟斤拷前系统锟斤拷锟绞憋拷锟�
try {
result = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT);
mTimeSeekBar.setMax(7);
if (result == 2147483000) {
mTimeSeekBar.setProgress(7);
mTimeValue.setText("");
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"standbytime_selection_box_never", "drawable"));
} else if (result == 1800000.0) {
mTimeSeekBar.setProgress(6);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("30");
} else if (result == 600000.0) {
mTimeSeekBar.setProgress(5);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("10");
} else if (result == 300000.0) {
mTimeSeekBar.setProgress(4);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("5");
} else if (result == 120000.0) {
mTimeSeekBar.setProgress(3);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("2");
} else if (result == 60000.0) {
mTimeSeekBar.setProgress(2);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("1");
} else if (result == 30000.0) {
mTimeSeekBar.setProgress(1);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("0.5");
}
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
// 锟斤拷锟斤拷
mSettingStandbytimeReduce.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
int Progress = 0;
// 锟斤拷取锟斤拷前系统锟斤拷锟绞憋拷锟�
try {
float result = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT);
mTimeSeekBar.setMax(7);
if (result == 2147483000) {
Progress = 7;
} else if (result == 1800000.0) {
Progress = 6;
} else if (result == 600000.0) {
Progress = 5;
} else if (result == 300000.0) {
Progress = 4;
} else if (result == 120000.0) {
Progress = 3;
} else if (result == 60000.0) {
Progress = 2;
} else if (result == 30000.0) {
Progress = 1;
}
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
if (Progress > 0) {
Progress = Progress - 1;
}
mTimeSeekBar.setProgress(Progress); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟斤拷锟斤拷锟�
}
});
// 锟接猴拷
mSettingStandbytimencrease.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
int Progress = 0;
// 锟斤拷取锟斤拷前系统锟斤拷锟绞憋拷锟�
try {
float result = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT);
mTimeSeekBar.setMax(7);
if (result == 2147483000) {
Progress = 7;
} else if (result == 1800000.0) {
Progress = 6;
} else if (result == 600000.0) {
Progress = 5;
} else if (result == 300000.0) {
Progress = 4;
} else if (result == 120000.0) {
Progress = 3;
} else if (result == 60000.0) {
Progress = 2;
} else if (result == 30000.0) {
Progress = 1;
}
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
if (Progress <= 6) {
Progress = Progress + 1;
}
mTimeSeekBar.setProgress(Progress); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟斤拷锟斤拷锟�
}
});
// 锟斤拷锟节达拷锟绞憋拷锟�
mTimeSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean arg2) {
switch (progress) {
case 1:
mTimeSeekBar.setProgress(progress);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("0.5");
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 30000);
break;
case 2:
mTimeSeekBar.setProgress(progress);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("1");
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 60000);
break;
case 3:
mTimeSeekBar.setProgress(progress);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("2");
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 120000);
break;
case 4:
mTimeSeekBar.setProgress(progress);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("5");
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 300000);
break;
case 5:
mTimeSeekBar.setProgress(progress);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("10");
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 600000);
break;
case 6:
mTimeSeekBar.setProgress(progress);
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"setting_standbytime_selection_box", "drawable"));
mTimeValue.setText("30");
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 1800000);
break;
case 7:
mTimeSeekBar.setProgress(progress);
mTimeValue.setText("");
mTimeValue.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(),
"standbytime_selection_box_never", "drawable"));
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 2147483000);
break;
default:
mTimeSeekBar.setProgress(1);
mTimeValue.setText("0.5");
break;
}
}
});
// 锟截憋拷
mTimePopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
if (mTimePopupWindow != null) {
mTimePopupWindow.dismiss();
mTimePopupWindow = null;
}
}
});
// 锟斤拷钮锟截憋拷
mSettinggStandbytimeClose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mTimePopupWindow != null) {
mTimePopupWindow.dismiss();
mTimePopupWindow = null;
}
}
});
}
class MyPostVideoWatchLog extends AsyncTask<String, Integer, String> {
@Override
protected String doInBackground(String... arg0) {
try {
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
/**
* 锟斤拷示锟斤拷锟斤拷锟斤拷锟矫达拷锟斤拷
*/
private void showSoundPopupWindow() {
if (mSoundPopupWindow != null) {
mSoundPopupWindow.dismiss();
mSoundPopupWindow = null;
}
mSoundSetting_popupWindow = (RelativeLayout) LayoutInflater.from(
SettingActivity.this).inflate(
R.layout.activity_setting_sound_item, null);
// 锟斤拷锟矫斤拷锟斤拷示锟侥达拷锟节的匡拷锟街碉拷锟轿拷锟侥伙拷锟斤拷值锟斤拷50%
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = 615;// 锟斤拷锟�
int height = 528;// 锟竭讹拷
mSoundPopupWindow = new PopupWindow(SettingActivity.this);
mSoundPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
mSoundPopupWindow.setWidth(width);
mSoundPopupWindow.setHeight(height);
mSoundPopupWindow.setOutsideTouchable(false);
mSoundPopupWindow.setFocusable(true);
mSoundPopupWindow.setContentView(mSoundSetting_popupWindow);
mSoundPopupWindow.showAtLocation(findViewById(R.id.setting_main),
Gravity.CENTER, 0, 0);// 锟斤拷示锟斤拷位锟斤拷为:锟斤拷锟斤拷诟锟斤拷丶锟斤拷锟斤拷锟�
// 锟截憋拷
mSoundSoundColse = (ImageView) mSoundSetting_popupWindow
.findViewById(R.id.settingg_sound_close);
// 锟斤拷锟斤拷锟斤拷锟斤拷
mSettingSoundReduce = (ImageView) mSoundSetting_popupWindow
.findViewById(R.id.setting_sound_reduce);
// 锟斤拷锟斤拷锟接猴拷
mSettingSoundIncrease = (ImageView) mSoundSetting_popupWindow
.findViewById(R.id.setting_sound_increase);
mImageSettingSound = (ImageView) mSoundSetting_popupWindow
.findViewById(R.id.img_setting_sound);
// 锟斤拷锟斤拷锟斤拷锟斤拷锟�
mSoundSeekBar = (SeekBar) mSoundSetting_popupWindow
.findViewById(R.id.soundSeekBar);
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
// 锟斤拷取锟斤拷前锟斤拷锟斤拷锟斤拷锟斤拷
int mVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
if (mVolume == 0) {
mImageSettingSound.setImageResource(R.drawable.sound_mute);
} else {
mImageSettingSound.setImageResource(R.drawable.setting_up_sound);
}
mSoundSeekBar.setMax(audioManager
.getStreamMaxVolume(AudioManager.STREAM_MUSIC)); // SEEKBAR锟斤拷锟斤拷为锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
mSoundSeekBar.setProgress(mVolume); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟斤拷锟斤拷锟�
registerVolumeChangeBroadcast();
// 锟斤拷锟斤拷锟斤拷锟斤拷
mSettingSoundReduce.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
int mVolume = audioManager
.getStreamVolume(AudioManager.STREAM_MUSIC);
if (mVolume > 0) {
mVolume = mVolume - 1;
}
mSoundSeekBar.setProgress(mVolume); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟斤拷锟斤拷锟�
}
});
// 锟斤拷锟斤拷锟接猴拷
mSettingSoundIncrease.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
int mVolume = audioManager
.getStreamVolume(AudioManager.STREAM_MUSIC);
if (mVolume <= 14) {
mVolume = mVolume + 1;
}
mSoundSeekBar.setProgress(mVolume); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟斤拷锟斤拷锟�
}
});
// 锟斤拷锟斤拷锟斤拷锟斤拷锟�
mSoundSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean arg2) {
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
progress, 0); // 锟较讹拷
Log.e("img_bg_sound", "arg1=" + progress);
if (progress == 0) {
mSoundLayout.setImageResource(R.drawable.mute);
mImageSettingSound.setImageResource(R.drawable.sound_mute);
mImageBGSound
.setImageResource(R.drawable.btn_music_off_state);
if (DataManager.getMainIsPlayEffectEnable(MyApplication.getAppContext())) {
DataManager.setMainIsPlayEffectEnable(
MyApplication.getAppContext(), false);
Log.e("--SettingActivity--",
DataManager.getMainIsPlayEffectEnable(MyApplication
.getAppContext()) + "");
}
} else {
mSoundLayout.setImageResource(R.drawable.sound_on);
mImageSettingSound
.setImageResource(R.drawable.setting_up_sound);
if (isOperBGSound) {
mImageBGSound
.setImageResource(R.drawable.btn_music_on_state);
}
if (DataManager.getMainIsPlayEffectEnable(MyApplication
.getAppContext())) {
return;
} else {
DataManager.setMainIsPlayEffectEnable(
MyApplication.getAppContext(), true);
}
}
}
});
// 锟截憋拷
mSoundPopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
unRegisterVolumeChangeBroadcast();
if (mSoundPopupWindow != null) {
mSoundPopupWindow.dismiss();
mSoundPopupWindow = null;
}
}
});
// 锟斤拷钮锟截憋拷
mSoundSoundColse.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mSoundPopupWindow != null) {
mSoundPopupWindow.dismiss();
mSoundPopupWindow = null;
}
}
});
}
/**
* 锟斤拷示锟斤拷锟斤拷锟斤拷锟矫达拷锟斤拷
*/
private void showBrightnessPopupWindow() {
if (mBrightnessPopupWindow != null) {
mBrightnessPopupWindow.dismiss();
mBrightnessPopupWindow = null;
}
mBrightnessSetting_popupWindow = (RelativeLayout) LayoutInflater.from(
SettingActivity.this).inflate(
R.layout.activity_setting_brightness_item, null);
// 锟斤拷锟矫斤拷锟斤拷示锟侥达拷锟节的匡拷锟街碉拷锟轿拷锟侥伙拷锟斤拷值锟斤拷50%
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = 615;// 锟斤拷锟�
int height = 528;// 锟竭讹拷
mBrightnessPopupWindow = new PopupWindow(SettingActivity.this);
mBrightnessPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
mBrightnessPopupWindow.setWidth(width);
mBrightnessPopupWindow.setHeight(height);
mBrightnessPopupWindow.setOutsideTouchable(false);
mBrightnessPopupWindow.setFocusable(true);
mBrightnessPopupWindow.setContentView(mBrightnessSetting_popupWindow);
mBrightnessPopupWindow.showAtLocation(findViewById(R.id.setting_main),
Gravity.CENTER, 0, 0);// 锟斤拷示锟斤拷位锟斤拷为:锟斤拷锟斤拷诟锟斤拷丶锟斤拷锟斤拷锟�
// 锟截憋拷
mSettingLightClose = (ImageView) mBrightnessSetting_popupWindow
.findViewById(R.id.settingg_light_close);
// 锟斤拷锟饺硷拷锟斤拷
mSettingBrightnessReduce = (ImageView) mBrightnessSetting_popupWindow
.findViewById(R.id.setting_brightness_reduce);
// 锟斤拷锟饺加猴拷
mSettingBrightnessIncrease = (ImageView) mBrightnessSetting_popupWindow
.findViewById(R.id.setting_brightness_increase);
// 锟斤拷锟饺斤拷锟斤拷锟�
mBrightnessSeekBar = (SeekBar) mBrightnessSetting_popupWindow
.findViewById(R.id.brightnessSeekBar);
// 锟斤拷取系统锟斤拷锟斤拷
mBrightnessVolume = Settings.System.getInt(
SettingActivity.this.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, -1);
mBrightnessSeekBar.setMax(255);
mBrightnessSeekBar.setProgress(mBrightnessVolume); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟饺斤拷锟�
// 锟斤拷锟饺硷拷锟斤拷
mSettingBrightnessReduce.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mBrightnessVolume > 5) {
mBrightnessVolume = mBrightnessVolume - 5;
}
if (mBrightnessVolume < 5) {
mBrightnessVolume = 5;
}
mBrightnessSeekBar.setProgress(mBrightnessVolume); // 锟斤拷锟斤拷SEEKBAR为锟斤拷前锟斤拷锟饺斤拷锟�
// 注锟斤拷锟斤拷锟斤拷锟斤拷锟街�~100锟斤拷锟斤拷锟芥到系统锟斤拷时要转锟斤拷为0~255
Uri uri = android.provider.Settings.System
.getUriFor(Settings.System.SCREEN_BRIGHTNESS);
ContentResolver resolver = SettingActivity.this
.getContentResolver();
android.provider.Settings.System.putInt(resolver,
Settings.System.SCREEN_BRIGHTNESS, mBrightnessVolume);
resolver.notifyChange(uri, null);
}
});
// 锟斤拷锟饺加猴拷
mSettingBrightnessIncrease.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mBrightnessVolume <= 250) {
mBrightnessVolume = mBrightnessVolume + 5;
} else {
mBrightnessVolume = 255;
}
mBrightnessSeekBar.setProgress(mBrightnessVolume); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟饺斤拷锟�
// 注锟斤拷锟斤拷锟斤拷锟斤拷锟街�~100锟斤拷锟斤拷锟芥到系统锟斤拷时要转锟斤拷为0~255
Uri uri = android.provider.Settings.System
.getUriFor(Settings.System.SCREEN_BRIGHTNESS);
ContentResolver resolver = SettingActivity.this
.getContentResolver();
android.provider.Settings.System.putInt(resolver,
Settings.System.SCREEN_BRIGHTNESS, mBrightnessVolume);
resolver.notifyChange(uri, null);
}
});
// 锟斤拷锟饺斤拷锟斤拷锟�
mBrightnessSeekBar
.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Uri uri = android.provider.Settings.System
.getUriFor(Settings.System.SCREEN_BRIGHTNESS);
ContentResolver resolver = SettingActivity.this
.getContentResolver();
android.provider.Settings.System.putInt(resolver,
Settings.System.SCREEN_BRIGHTNESS,
seekBar.getProgress());
resolver.notifyChange(uri, null);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar,
int progress, boolean fromUser) {
if (progress < 5) {
progress = 5;
}
mBrightnessVolume = progress;
mBrightnessSeekBar.setProgress(progress); // 锟斤拷锟斤拷seekbar为锟斤拷前锟斤拷锟饺斤拷锟�
// 注锟斤拷锟斤拷锟斤拷锟斤拷锟街�~100锟斤拷锟斤拷锟芥到系统锟斤拷时要转锟斤拷为0~255
Uri uri = android.provider.Settings.System
.getUriFor(Settings.System.SCREEN_BRIGHTNESS);
ContentResolver resolver = SettingActivity.this
.getContentResolver();
android.provider.Settings.System.putInt(resolver,
Settings.System.SCREEN_BRIGHTNESS, progress);
resolver.notifyChange(uri, null);
}
});
// 锟截憋拷
mBrightnessPopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
if (mBrightnessPopupWindow != null) {
mBrightnessPopupWindow.dismiss();
mBrightnessPopupWindow = null;
}
}
});
// 锟截闭帮拷钮
mSettingLightClose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mBrightnessPopupWindow != null) {
mBrightnessPopupWindow.dismiss();
mBrightnessPopupWindow = null;
}
}
});
}
private void showExitLogin() {
if (mExitLoginPopuWindow != null) {
mExitLoginPopuWindow.dismiss();
mExitLoginPopuWindow = null;
}
if (mExitLoginRelativelayout == null) {
mExitLoginRelativelayout = (RelativeLayout) LayoutInflater.from(
SettingActivity.this).inflate(R.layout.exit_login_dailog,
null);
}
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = (int) (dm.widthPixels);
int height = (int) (dm.heightPixels);
mExitLoginPopuWindow = new PopupWindow(SettingActivity.this);
mExitLoginPopuWindow.setBackgroundDrawable(new ColorDrawable(0));
mExitLoginPopuWindow.setWidth(width);
mExitLoginPopuWindow.setHeight(height);
mExitLoginPopuWindow.setOutsideTouchable(false);
mExitLoginPopuWindow.setFocusable(true);
mExitLoginPopuWindow.setContentView(mExitLoginRelativelayout);
mExitLoginPopuWindow.showAtLocation(findViewById(R.id.setting_main),
Gravity.CENTER, 0, 0);
TextView loginTitle = (TextView) mExitLoginRelativelayout
.findViewById(R.id.login_title_tv);
loginTitle.setTypeface(mTypeface);
LoginState loginState = LoginState.getInstance();
mUserName = (TextView) mExitLoginRelativelayout
.findViewById(R.id.login_account_tv);
mUserName.setTypeface(mTypeface);
mUserName.setText(loginState.getAccount());
mExitCancle = (ImageView) mExitLoginRelativelayout
.findViewById(R.id.bb_cancels_extit_btn);
mExitLogin = (ImageView) mExitLoginRelativelayout
.findViewById(R.id.login_out_btn);
mChangePSWBtn = (ImageView) mExitLoginRelativelayout
.findViewById(R.id.change_psw_btn);
mExitLogin.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(), "exit_selector", "drawable"));
mChangePSWBtn.setBackgroundResource(Utils.getResourcesId(MyApplication.getAppContext(), "update_password_selector", "drawable"));
mExitCancle.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mExitLoginPopuWindow != null) {
mExitLoginPopuWindow.dismiss();
mExitLoginPopuWindow = null;
}
}
});
mExitLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
LoginState loginState = LoginState.getInstance();
String httpUrl = Configure.LOGIN_OUT_URL.replace("ACCOUNT",
loginState.getUserName()).replace("DEVICE_ID",
Utils.getCpuSerial(getApplicationContext()));
HttpUtils.doPost(httpUrl, SettingActivity.this,
Configure.HTTP_TAG_LOGIN_OUT);
editor.clear();
editor.commit();
loginState.loginOut();
SettingActivity.this.sendBroadcast(new Intent(
Utils.LOGIN_OUT_ACTICON));
if (mExitLoginPopuWindow != null) {
mExitLoginPopuWindow.dismiss();
mExitLoginPopuWindow = null;
}
updateAccountView();
showLogin();
}
});
mChangePSWBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mExitLoginPopuWindow != null) {
mExitLoginPopuWindow.dismiss();
mExitLoginPopuWindow = null;
}
showXiuGaiPassword(null);
}
});
}
@Override
protected void onResume() {
super.onResume();
//刷新用户信息
updateAccountView();
//注册WIFI状态广播
mWifiIntentFilter = new IntentFilter();
mWifiIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
if (mWifiIntentReceiver != null) {
registerReceiver(mWifiIntentReceiver,mWifiIntentFilter);
}
}
/*
*WIFI网络断开时广播,账户注销。
*/
private BroadcastReceiver mWifiIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int wifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_DISABLED);
if (wifiState == WifiManager.WIFI_STATE_DISABLED) {
LoginState loginState = LoginState.getInstance();
/*String httpUrl = Configure.LOGIN_OUT_URL.replace("ACCOUNT",
loginState.getUserName()).replace("DEVICE_ID",
Utils.getCpuSerial(getApplicationContext()));
HttpUtils.doPost(httpUrl, SettingActivity.this,
Configure.HTTP_TAG_LOGIN_OUT);*/
editor.clear();
loginState.loginOut();
//SettingActivity.this.sendBroadcast(new Intent(
//Utils.LOGIN_OUT_ACTICON));
updateAccountView();
}
}
};
private void showLogin() {
if (mLoginPopuWindow != null) {
mLoginPopuWindow.dismiss();
mLoginPopuWindow = null;
}
mRegisterRelativelayout = (RelativeLayout) LayoutInflater.from(
SettingActivity.this).inflate(R.layout.login_dailog, null);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = (int) (dm.widthPixels);
int height = (int) (dm.heightPixels);
mLoginPopuWindow = new PopupWindow(SettingActivity.this);
mLoginPopuWindow.setBackgroundDrawable(new ColorDrawable(0));
mLoginPopuWindow.setWidth(width);
mLoginPopuWindow.setHeight(height);
mLoginPopuWindow.setOutsideTouchable(false);
mLoginPopuWindow.setFocusable(true);
mLoginPopuWindow.setContentView(mRegisterRelativelayout);
mLoginPopuWindow.showAtLocation(findViewById(R.id.setting_main),
Gravity.CENTER, 0, 0);
mZhangHao_text = (TextView) mRegisterRelativelayout
.findViewById(R.id.accountnumber_textview);
mZhangHao_text.setTypeface(mTypeface);
// mUpdatePassword=(TextView)mRegisterRelativelayout.findViewById(R.id.xiugai_password_textview);
// mUpdatePassword.setTypeface(mTypeface);
mMiMa_text = (TextView) mRegisterRelativelayout
.findViewById(R.id.password_textview);
mMiMa_text.setTypeface(mTypeface);
mZhangHao = (EditText) mRegisterRelativelayout
.findViewById(R.id.accountnumber_edittext);
mZhangHao.setTypeface(mTypeface);
mZhangHao.setOnFocusChangeListener(mInputFocusChangeListener);
mMiMa = (EditText) mRegisterRelativelayout
.findViewById(R.id.password_edittext);
mMiMa.setTypeface(mTypeface);
mLogin = (ImageView) mRegisterRelativelayout
.findViewById(R.id.bb_denglu_btn);
mLogin.setBackgroundResource(Utils.getResourcesId(
MyApplication.getAppContext(), "login_selector", "drawable"));
mCanle = (ImageView) mRegisterRelativelayout
.findViewById(R.id.bb_cancels_btn);
mRegister = (TextView) mRegisterRelativelayout
.findViewById(R.id.register_textview);
mRegister.setTypeface(mTypeface);
mForgetPassWord = (TextView) mRegisterRelativelayout
.findViewById(R.id.forget_password_textview);
mForgetPassWord.setTypeface(mTypeface);
mCanle.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mLoginPopuWindow != null) {
mLoginPopuWindow.dismiss();
mLoginPopuWindow = null;
}
}
});
mLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
String zhanghao = mZhangHao.getText().toString().trim();
String mima = mMiMa.getText().toString().trim();
String cpuSerial = Utils.getCpuSerial(getApplicationContext());
if (zhanghao.length() != 0 && mima.length() != 0) {
editor.putString("account", zhanghao);//账号保存到本地。
editor.putString("password", mima); //密码保存
editor.commit();
String httpUrl = Configure.LOGIN_URL
.replace("ACCOUNT", zhanghao)
.replace("PASSWORD", MD5Util.string2MD5(mima))
.replace("DEVICE_ID", cpuSerial);
Log.e("lee", "httpUrl == " + httpUrl);
HttpUtils.doPost(httpUrl, SettingActivity.this,
Configure.HTTP_TAG_LOGIN);
} else {
Utils.showToastMessage(SettingActivity.this,
getString(R.string.login_input_error));
}
}
});
mRegister.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
try {
Intent intent = new Intent();
intent.putExtra("isRegister", true);
ComponentName comp = new ComponentName(
"com.worldchip.bbpaw.bootsetting",
"com.worldchip.bbpaw.bootsetting.activity.WifiListActivity");
intent.setComponent(comp);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
});
mForgetPassWord.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mLoginPopuWindow != null) {
mLoginPopuWindow.dismiss();
mLoginPopuWindow = null;
}
showForgetPassword();
}
});
}
private void showForgetPassword() {
if (mForgetPasswordPopuwindow != null) {
mForgetPasswordPopuwindow.dismiss();
mForgetPasswordPopuwindow = null;
}
mForgetPasswordRelativelayout = (RelativeLayout) LayoutInflater.from(
SettingActivity.this).inflate(R.layout.forget_password_dailog,
null);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = (int) (dm.widthPixels);
int height = (int) (dm.heightPixels);
mForgetPasswordPopuwindow = new PopupWindow(SettingActivity.this);
mForgetPasswordPopuwindow.setBackgroundDrawable(new ColorDrawable(0));
mForgetPasswordPopuwindow.setWidth(width);
mForgetPasswordPopuwindow.setHeight(height);
mForgetPasswordPopuwindow.setOutsideTouchable(false);
mForgetPasswordPopuwindow.setFocusable(true);
mForgetPasswordPopuwindow.setContentView(mForgetPasswordRelativelayout);
mForgetPasswordPopuwindow.showAtLocation(
findViewById(R.id.setting_main), Gravity.CENTER, 0, 0);
mForgetPasswordPopuwindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
// TODO Auto-generated method stub
stopVerficationRefreshTimer();
}
});
// mFindAccountTV = (TextView) mForgetPasswordRelativelayout
// .findViewById(R.id.account_find_title);
// mFindAccountTV.setTypeface(mTypeface);
mValidateCodeET = (EditText) mForgetPasswordRelativelayout
.findViewById(R.id.validate_code_et);
mValidateCodeET.setTypeface(mTypeface);
mFindAccountET = (EditText) mForgetPasswordRelativelayout
.findViewById(R.id.find_psw_account_et);
mFindAccountET.setTypeface(mTypeface);
mValidateCodeET.setOnFocusChangeListener(mInputFocusChangeListener);
mFindAccountET.setOnFocusChangeListener(mInputFocusChangeListener);
mValidateCodeBtn = (Button) mForgetPasswordRelativelayout
.findViewById(R.id.validate_code_btn);
mValidateCodeBtn.setBackgroundResource(Utils.getResourcesId(
MyApplication.getAppContext(), "validatecode_selector", "drawable"));
mValidateCodeBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
getVerficationCode();
}
});
mForfetPasswordCancle = (ImageView) mForgetPasswordRelativelayout
.findViewById(R.id.forget_canle_button);
mForgetPasswordConfrim = (ImageView) mForgetPasswordRelativelayout
.findViewById(R.id.forget_comfrim_button);
mForfetPasswordCancle.setBackgroundResource(Utils.getResourcesId(
MyApplication.getAppContext(), "canlce_selector", "drawable"));
mForgetPasswordConfrim.setBackgroundResource(Utils.getResourcesId(
MyApplication.getAppContext(), "confrim_button_selector", "drawable"));
mForfetPasswordCancle.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mForgetPasswordPopuwindow != null) {
mForgetPasswordPopuwindow.dismiss();
mForgetPasswordPopuwindow = null;
}
}
});
mForgetPasswordConfrim.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
commitFindPassword();
}
});
}
private void showXiuGaiPassword(final FindPasswordInfo pswInfo) {
if (mXiuGaiPassWordPopuwindow != null) {
mXiuGaiPassWordPopuwindow.dismiss();
mXiuGaiPassWordPopuwindow = null;
}
mXiuGaiPasswordRelativelayout = (RelativeLayout) LayoutInflater.from(
SettingActivity.this).inflate(R.layout.xiugai_password_dailog,
null);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = (int) (dm.widthPixels);
int height = (int) (dm.heightPixels);
mXiuGaiPassWordPopuwindow = new PopupWindow(SettingActivity.this);
mXiuGaiPassWordPopuwindow.setBackgroundDrawable(new ColorDrawable(0));
mXiuGaiPassWordPopuwindow.setWidth(width);
mXiuGaiPassWordPopuwindow.setHeight(height);
mXiuGaiPassWordPopuwindow.setOutsideTouchable(false);
mXiuGaiPassWordPopuwindow.setFocusable(true);
mXiuGaiPassWordPopuwindow.setContentView(mXiuGaiPasswordRelativelayout);
mXiuGaiPassWordPopuwindow.showAtLocation(
findViewById(R.id.setting_main), Gravity.CENTER, 0, 0);
mXiuGaiPassword = (TextView) mXiuGaiPasswordRelativelayout
.findViewById(R.id.change_psw_title);
mXiuGaiPassword.setTypeface(mTypeface);
mOldPassword = (TextView) mXiuGaiPasswordRelativelayout
.findViewById(R.id.jiumima_textview);
mOldPassword.setTypeface(mTypeface);
View oldPasswordView = mXiuGaiPasswordRelativelayout.findViewById(R.id.old_password_ll);
if (pswInfo != null) {
oldPasswordView.setVisibility(View.GONE);
} else {
oldPasswordView.setVisibility(View.VISIBLE);
}
mNewPassword = (TextView) mXiuGaiPasswordRelativelayout
.findViewById(R.id.xinmima_textview);
mNewPassword.setTypeface(mTypeface);
mConfrimPassword = (TextView) mXiuGaiPasswordRelativelayout
.findViewById(R.id.comfrin_password_textview);
mConfrimPassword.setTypeface(mTypeface);
mOldPassword_edittext = (EditText) mXiuGaiPasswordRelativelayout
.findViewById(R.id.jiumima_edittext);
mOldPassword_edittext.setTypeface(mTypeface);
mNewPassword_edittext = (EditText) mXiuGaiPasswordRelativelayout
.findViewById(R.id.xinmima_edittext);
mNewPassword_edittext.setTypeface(mTypeface);
mConfrimPassword_edittext = (EditText) mXiuGaiPasswordRelativelayout
.findViewById(R.id.comfrin_password_edittext);
mConfrimPassword_edittext.setTypeface(mTypeface);
mXiuGaiPasswordCanle = (ImageView) mXiuGaiPasswordRelativelayout
.findViewById(R.id.forgetpassword_canle_button);
mXiuGaiPasswordConfrim = (ImageView) mXiuGaiPasswordRelativelayout
.findViewById(R.id.forgetpassword_comfrim_button);
mXiuGaiPasswordConfrim.setBackgroundResource(Utils.getResourcesId(
MyApplication.getAppContext(), "confrim_button_selector",
"drawable"));
mXiuGaiPasswordCanle.setBackgroundResource(Utils.getResourcesId(
MyApplication.getAppContext(), "canlce_selector", "drawable"));
mXiuGaiPasswordCanle.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
if (mXiuGaiPassWordPopuwindow != null) {
mXiuGaiPassWordPopuwindow.dismiss();
mXiuGaiPassWordPopuwindow = null;
}
}
});
mXiuGaiPasswordConfrim.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
String oldpassword = (pswInfo != null ? pswInfo.getOriginalPassword() : mOldPassword_edittext.getText().toString().trim());
Log.e("lee", "oldpassword == "+oldpassword);
String newpassword = mNewPassword_edittext.getText().toString().trim();
String confrimpassword = mConfrimPassword_edittext.getText().toString().trim();
String CpuSerial = Utils.getCpuSerial(getApplicationContext());
if (oldpassword.length() != 0 && newpassword.length() != 0
&& confrimpassword.length() != 0) {
if (newpassword.matches("^[a-z0-9A-Z]{6,16}$")) {
if (newpassword.equals(confrimpassword)) {
if (pswInfo != null || !oldpassword.equals(newpassword)) {
String httpUrl = Configure.UPDATE_PASSWORD
.replace("ADMIN", pswInfo == null ? LoginState.getInstance().getAccount() : pswInfo.getAccount())
.replace("NEWPASSWORD", MD5Util.string2MD5(newpassword))
.replace("OLDPASSWORD", pswInfo != null ? oldpassword : MD5Util.string2MD5(oldpassword))
.replace("DEVICE_ID", CpuSerial);
Log.e("lee", "httpUrl == " + httpUrl);
HttpUtils.doPost(httpUrl, SettingActivity.this, Configure.HTTP_TAG_UPDATE_PASSWORD);
} else {
Utils.showToastMessage(SettingActivity.this, getString(R.string.original_eq_newpsw_error_text));
}
} else {
Utils.showToastMessage(SettingActivity.this, getString(R.string.code_input_agen));
}
} else {
Utils.showToastMessage(SettingActivity.this, getString(R.string.validate_psw_empty_error));
}
} else {
Utils.showToastMessage(SettingActivity.this, getString(R.string.code_not_empty));
}
}
});
}
public void onClick(View view) {
mSoundpool.play(mSoundMap.get(30), 1, 1, 0, 0, 1);
switch (view.getId()) {
case R.id.name_and_image_btn:
if (!LoginState.getInstance().isLogin()) {
showLogin();
} else {
showExitLogin();
}
break;
case R.id.stand_by_time_ll:
showTimePopupWindow();
break;
case R.id.sound_ll:
showSoundPopupWindow();
break;
case R.id.brightness_ll:
showBrightnessPopupWindow();
break;
case R.id.wifi_image:
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifiManager.isWifiEnabled()) {
Toast.makeText(SettingActivity.this, R.string.wifi_off,
Toast.LENGTH_SHORT).show();
wifiManager.setWifiEnabled(false);
mWifi_image.setImageResource(R.drawable.wifi_off);
} else {
Toast.makeText(SettingActivity.this, R.string.wifi_on,
Toast.LENGTH_SHORT).show();
wifiManager.setWifiEnabled(true);
mWifi_image.setImageResource(R.drawable.wifi_on);
}
break;
/*case R.id.bluetooth_imgage:
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter
.getDefaultAdapter();
if (mBluetoothAdapter != null) {
if (mBluetoothAdapter.isEnabled()) {
// Utils.showToastMessage(SettingActivity.this,
mBluetoothAdapter.disable();
mBluetooth_imgage
.setImageResource(R.drawable.bluetooth_off);
} else {
// Utils.showToastMessage(SettingActivity.this,
mBluetoothAdapter.enable();
mBluetooth_imgage.setImageResource(R.drawable.bluetooth_on);
}
} else {
// Utils.showToastMessage(SettingActivity.this,
}
break;*/
case R.id.sensor_image:
//SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
//Sensor sensor_accelerometer = sensorManager
// .getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
SharedPreferences configShard = getSharedPreferences("config", 0);
boolean sensorSwitch = configShard.getBoolean("sensor_switch", true);
if (sensorSwitch) {
Toast.makeText(SettingActivity.this,
R.string.accelerometer_on, Toast.LENGTH_SHORT).show();
mSensorImage.setImageResource(R.drawable.accelerometer_on);
} else {
//sensorManager.registerListener(null, sensor_accelerometer,
// SensorManager.SENSOR_DELAY_UI);
Toast.makeText(SettingActivity.this, R.string.accelerometer_off,
Toast.LENGTH_SHORT).show();
mSensorImage.setImageResource(R.drawable.accelerometer_off);
}
configShard.edit().putBoolean("sensor_switch", !sensorSwitch).commit();
break;
case R.id.img_bg_sound:
if (DataManager.getMainIsPlayEffectEnable(MyApplication
.getAppContext())) {
DataManager.setMainIsPlayBackgroundMusicEnable(
MyApplication.getAppContext(), !isOperBGSound);
isOperBGSound = !isOperBGSound;
if (isOperBGSound) {
mImageBGSound
.setImageResource(R.drawable.btn_music_on_state);
} else {
mImageBGSound
.setImageResource(R.drawable.btn_music_off_state);
}
}
break;
case R.id.setting_back:
SettingActivity.this.finish();
break;
default:
break;
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e("onActivityResult", requestCode + "-------------" + resultCode);
switch (resultCode) {
case 0:
break;
case 1:
break;
case 800:
mBabyMoren_edite.setImageBitmap(HttpCommon
.getImageBitmap(getPackageName()));
break;
default:
if (requestCode == 100) {
if (data == null)
return;
Uri uri = data.getData();
Intent intent = new Intent();
intent.setAction("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
intent.putExtra("crop", "true");
// aspectX aspectY 锟角匡拷叩谋锟斤拷锟�
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
// outputX outputY 锟角裁硷拷图片锟斤拷锟�
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 200);
intent.putExtra("return-data", true);
SettingActivity.this.startActivityForResult(intent, 200);
} else if (requestCode == 200) // 锟斤拷锟斤拷图片
{
if (data == null)
return;
Bitmap bmap = data.getParcelableExtra("data");
mBabyMoren_edite.setImageBitmap(bmap);
} else if (requestCode == 500)
{
if (data == null)
return;
Bitmap bmap = data.getParcelableExtra("data");
if (bmap == null) {
return;
}
mBabyMoren_edite.setImageBitmap(bmap);
}
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public boolean onDown(MotionEvent arg0) {
return false;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
SharedPreferences image_name = getSharedPreferences("image_name", 0);
int index = image_name.getInt("index", 0);
Resources res = getResources();
Bitmap bmp = null;
if (e1.getX() - e2.getX() > FLING_MIN_DISTANCE
&& Math.abs(velocityX) > FLING_MIN_VELOCITY) {
switch (index) {
case 0:
mImageNameBig.setImageResource(ResourceManager.SYSTME_IMAGE[2]);
// mNameAndImageBtn.setImageResource(HttpCommon.res[2]);
image_name.edit().putInt("index", 2).commit();
bmp = BitmapFactory.decodeResource(res,
ResourceManager.SYSTME_IMAGE[2]);
break;
case 1:
mImageNameBig.setImageResource(ResourceManager.SYSTME_IMAGE[0]);
// mNameAndImageBtn.setImageResource(HttpCommon.res[0]);
image_name.edit().putInt("index", 0).commit();
bmp = BitmapFactory.decodeResource(res,
ResourceManager.SYSTME_IMAGE[0]);
break;
case 2:
mImageNameBig.setImageResource(ResourceManager.SYSTME_IMAGE[1]);
// mNameAndImageBtn.setImageResource(HttpCommon.res[1]);
image_name.edit().putInt("index", 1).commit();
bmp = BitmapFactory.decodeResource(res,
ResourceManager.SYSTME_IMAGE[1]);
break;
default:
break;
}
HttpCommon.SavaImage(bmp, getPackageName());
} else if (e2.getX() - e1.getX() > FLING_MIN_DISTANCE
&& Math.abs(velocityX) > FLING_MIN_VELOCITY) {
switch (index) {
case 0:
mImageNameBig.setImageResource(ResourceManager.SYSTME_IMAGE[1]);
// mNameAndImageBtn.setImageResource(HttpCommon.res[1]);
image_name.edit().putInt("index", 1).commit();
bmp = BitmapFactory.decodeResource(res,
ResourceManager.SYSTME_IMAGE[1]);
break;
case 1:
mImageNameBig.setImageResource(ResourceManager.SYSTME_IMAGE[2]);
// mNameAndImageBtn.setImageResource(HttpCommon.res[2]);
image_name.edit().putInt("index", 2).commit();
bmp = BitmapFactory.decodeResource(res,
ResourceManager.SYSTME_IMAGE[2]);
break;
case 2:
mImageNameBig.setImageResource(ResourceManager.SYSTME_IMAGE[0]);
// mNameAndImageBtn.setImageResource(HttpCommon.res[0]);
image_name.edit().putInt("index", 0).commit();
bmp = BitmapFactory.decodeResource(res,
ResourceManager.SYSTME_IMAGE[0]);
break;
default:
break;
}
HttpCommon.SavaImage(bmp, getPackageName());
}
return false;
}
@Override
public void onLongPress(MotionEvent arg0) {
}
@Override
public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2,
float arg3) {
return false;
}
@Override
public void onShowPress(MotionEvent arg0) {
}
@Override
public boolean onSingleTapUp(MotionEvent arg0) {
return false;
}
private MyVolumeReceiver mVolumeReceiver;
/**
* Register when the volume changes received broadcast
*/
private void registerVolumeChangeBroadcast() {
mVolumeReceiver = new MyVolumeReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction("android.media.VOLUME_CHANGED_ACTION");
registerReceiver(mVolumeReceiver, filter);
}
private void unRegisterVolumeChangeBroadcast() {
try {
if (mVolumeReceiver != null) {
unregisterReceiver(mVolumeReceiver);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* When handling the volume change of interface display
*
* @author long
*/
private class MyVolumeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟戒化锟斤拷锟斤拷seekbar锟斤拷位锟斤拷
if (intent.getAction()
.equals("android.media.VOLUME_CHANGED_ACTION")) {
int currVolume = audioManager
.getStreamVolume(AudioManager.STREAM_MUSIC);// 锟斤拷前锟斤拷媒锟斤拷锟斤拷锟斤拷
if (mSoundSeekBar != null) {
mSoundSeekBar.setProgress(currVolume);
}
}
}
}
@Override
public void onStart(String httpTag) {
mHandler.sendEmptyMessage(START_PROGRESS_DIALOG);
}
@Override
public void onSuccess(String result, String httpTag) {
if (Configure.DEBUG) {
Log.e("lee", "onSuccess response == " + result.toString()
+ " ----------->>>" + httpTag);
Log.e("Wing", result.toString());
}
Message msg = new Message();
Bundle bundle = new Bundle();
msg.what = HTTP_REQ_CODE;
msg.arg1 = Configure.SUCCESS;
bundle.putString("httpTag", httpTag);
bundle.putString("result", result);
msg.setData(bundle);
mHandler.sendMessage(msg);
}
@Override
public void onFailure(Exception e, String httpTag) {
if (httpTag.equals(Configure.HTTP_TAG_LOGIN)) {
mHandler.post(new Runnable() {
@Override
public void run() {
Utils.showToastMessage(MyApplication.getAppContext(),
getString(R.string.login_failure));
}
});
}
if (httpTag.equals(Configure.HTTP_TAG_UPDATE_PASSWORD)) {
mHandler.post(new Runnable() {
@Override
public void run() {
Utils.showToastMessage(MyApplication.getAppContext(),
getString(R.string.update_password_failure));
}
});
}
}
@Override
public void onFinish(int result, String httpTag) {
if (result == HttpUtils.HTTP_RESULT_NETWORK_ERROR) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
HttpUtils.handleRequestExcption(HttpUtils.HTTP_RESULT_NETWORK_ERROR);
}
});
}
mHandler.sendEmptyMessage(STOP_PROGRESS_DIALOG);
}
private void handResultMessge(int resultCode, String httpTag,Object result) {
String messageText = "";
Log.e("lee", "handResultMessge resultCode == "+resultCode + "-------" + result);
if (resultCode == HttpUtils.HTTP_RESULT_CODE_SUCCESS) {
if (httpTag.equals(Configure.HTTP_TAG_LOGIN)) {
messageText = getString(R.string.login_seccuss);
SettingActivity.this.sendBroadcast(new Intent(
Utils.LOGIN_SECCUSS_ACTION));
if (mLoginPopuWindow != null) {
mLoginPopuWindow.dismiss();
mLoginPopuWindow = null;
}
if (result != null) {
LoginState loaLoginState = (LoginState)result;
loaLoginState.setLogin(true);
loaLoginState.setAccount(mZhangHao.getText().toString().trim());
showExitLogin();
}
updateAccountView();
} else if (httpTag.equals(Configure.HTTP_TAG_UPDATE_PASSWORD)) {
messageText = getString(R.string.update_password_suceecss);
if (mXiuGaiPassWordPopuwindow != null) {
mXiuGaiPassWordPopuwindow.dismiss();
mXiuGaiPassWordPopuwindow = null;
}
//showExitLogin();
showLogin();
} else if (httpTag.equals(Configure.HTTP_TAG_GET_VERFICATION_CODE)) {
messageText = getString(R.string.validate_code_sendent);
} else if (httpTag.equals(Configure.HTTP_TAG_GET_OLD_PSW)) {
if (mForgetPasswordPopuwindow != null) {
mForgetPasswordPopuwindow.dismiss();
mForgetPasswordPopuwindow = null;
}
if (result != null) {
showXiuGaiPassword((FindPasswordInfo)result);
}
}
} else {
HttpUtils.handleRequestExcption(resultCode);
}
if (!TextUtils.isEmpty(messageText)) {
Utils.showToastMessage(MyApplication.getAppContext(), messageText);
}
}
private OnFocusChangeListener mInputFocusChangeListener = new OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
// TODO Auto-generated method stub
EditText accountEdit = (EditText)view;
String hint;
if (hasFocus) {
hint = accountEdit.getHint().toString();
accountEdit.setTag(hint);
accountEdit.setHint("");
} else {
hint = accountEdit.getTag().toString();
accountEdit.setHint(hint);
}
}
};
class VerificationRefreshTask extends TimerTask {
@Override
public void run() {
mHandler.sendMessage(mHandler
.obtainMessage(MSG_GET_VERIFICATION_CODE));
}
}
private void startVerficationRefreshTimer() {
if (mValidateCodeBtn != null) {
mValidateCodeBtn.setEnabled(false);
}
if (mTimer != null) {
mTimer.cancel();
}
mTimer = new Timer();
if (mRefreshTask != null) {
mRefreshTask.cancel();
}
mRefreshTask = new VerificationRefreshTask();
if (mTimer != null && mRefreshTask != null) {
mTimer.schedule(mRefreshTask, 0, 1000);
}
}
private void stopVerficationRefreshTimer() {
if (mValidateCodeBtn != null) {
mValidateCodeBtn.setEnabled(true);
INTERVAL = 60;
}
if (mTimer != null) {
mTimer.cancel();
mTimer = null;
}
if (mRefreshTask != null) {
mRefreshTask.cancel();
mRefreshTask = null;
}
}
private void getVerficationCode() {
startVerficationRefreshTimer();
if (mFindAccountET != null) {
String account = mFindAccountET.getText().toString();
String language = null;
if(Utils.getLanguageInfo(this) == Utils.ENG_LANGUAGE_INDEX){
language = "ENGLISH";
} else {
language = "CHINESE";
}
if (!TextUtils.isEmpty(account)) {
String httpUrl = Configure.GET_VERFICATION_CODE.replace("LANGUAGE", language).replace("ACCOUNT", account)
.replace("DEVICE_ID", Utils.getCpuSerial(MyApplication.getAppContext()));
Log.e("lee", " httpUrl == "+httpUrl);
HttpUtils.doPost(httpUrl, SettingActivity.this, Configure.HTTP_TAG_GET_VERFICATION_CODE);
} else {
Utils.showToastMessage(MyApplication.getAppContext(), getString(R.string.find_account_empty_error));
}
}
}
private void commitFindPassword() {
if (mFindAccountET != null) {
String account = mFindAccountET.getText().toString();
if (!TextUtils.isEmpty(account)) {
String code = mValidateCodeET.getText().toString();
if (!TextUtils.isEmpty(code)) {
String httpUrl = Configure.GET_OLD_PSW.replace("ACCOUNT", account)
.replace("DEVICE_ID", Utils.getCpuSerial(MyApplication.getAppContext()))
.replaceFirst("CODE", code);
HttpUtils.doPost(httpUrl, SettingActivity.this, Configure.HTTP_TAG_GET_OLD_PSW);
} else {
Utils.showToastMessage(MyApplication.getAppContext(), getString(R.string.verfication_code_empty_error));
}
}else {
Utils.showToastMessage(MyApplication.getAppContext(), getString(R.string.find_account_empty_error));
}
}
}
private void startProgressDialog() {
if (mGlobalProgressDialog == null) {
mGlobalProgressDialog = GlobalProgressDialog.createDialog(this);
}
mGlobalProgressDialog.show();
}
private void stopProgressDialog() {
if (mGlobalProgressDialog != null) {
mGlobalProgressDialog.dismiss();
mGlobalProgressDialog = null;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mWifiIntentReceiver != null) {
unregisterReceiver(mWifiIntentReceiver);
}
}
} |
package com.zhicai.byteera.activity.community.dynamic.adapter;
import android.content.Context;
import com.zhicai.byteera.activity.community.classroom.view.BaseHolder;
import com.zhicai.byteera.activity.community.classroom.view.LieeberAdapter;
import com.zhicai.byteera.activity.community.dynamic.view.ClickToLoadMoreView;
import com.zhicai.byteera.activity.community.dynamic.view.ClickToLoadMoreView.LoadMoreListener;
import com.zhicai.byteera.activity.community.dynamic.view.ClickToLoadMoreView.State;
import com.zhicai.byteera.activity.community.dynamic.view.OrganizationHomeProductItem;
import com.zhicai.byteera.activity.product.entity.ProductEntity;
/** Created by bing on 2015/5/3. */
public class OrganizationHomeProductAdapter extends LieeberAdapter {
private static int LIST_TYPE = 0;
private static int MORE_TYPE = 1;
public OrganizationHomeProductAdapter(Context context) {
super(context);
}
public interface LoadingMoreListener {
void loadingMore();
}
public void setLoadMoreListener(LoadMoreListener listener) {
this.moreListener = listener;
}
private LoadMoreListener moreListener;
@Override
protected BaseHolder checkType(int position) {
if (getItemType(position) == LIST_TYPE) {
return new OrganizationHomeProductItem(mContext);
} else if (getItemType(position) == MORE_TYPE) {
final ClickToLoadMoreView footView = new ClickToLoadMoreView(mContext);
footView.setLoadMoreListener(new LoadMoreListener() {
@Override public void loadingMore() {
if (moreListener != null) {
moreListener.loadingMore();
footView.setLoadState(State.LOAD);
}
}
});
return footView;
}
return null;
}
@Override
public BaseHolder getHolder(BaseHolder holder, int position) {
if (holder instanceof ClickToLoadMoreView) {
((ClickToLoadMoreView) holder).setLoadState(State.IDLE);
}
return holder;
}
@Override
protected int getItemType(int position) {
if (mList.get(position) instanceof ProductEntity) {
return LIST_TYPE;
} else {
return MORE_TYPE;
}
}
@Override
public int getItemTypeCount() {
return 2;
}
}
|
package org.dain.daydayup.concurrent.thread.future;
import java.util.concurrent.CountDownLatch;
/**
* @Description 模拟Future的客户端
* @Author lideyin
* @Date 2019/8/21 22:50
* @Version 1.0
*/
public class FutureClient {
//使用countDownLatch对象来实现异步等待通知
private CountDownLatch countDownLatch = new CountDownLatch(1);
//模拟Future的提交方法
public Data submit(final String queryParam){
//定义需要立即返回的future对象
FutureData futureData = new FutureData(countDownLatch);
//启子线程处理需要真实操作的业务
new Thread(()->{
RealData realData = new RealData(countDownLatch);
//调用真实对象处理相关业务
realData.processData(queryParam);
//将真实对象的引用添加到future对象中
futureData.setRealData(realData);
}).start();
return futureData;
}
}
|
package com.example.demo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@Autowired
private UserClient userClient;
@Autowired
private AccountClient accountClient;
@RequestMapping(value="/userRegister", method=RequestMethod.POST)
public List userRegister(@RequestParam(value = "account", required = true) String account, @RequestParam(value = "password", required = true) String password) {
return userClient.userRegister(account, password);
}
@RequestMapping(value="/userLogin", method=RequestMethod.POST)
public List userLogin(@RequestParam(value = "account", required = true) String account, @RequestParam(value = "password", required = true) String password) {
return userClient.userLogin(account, password);
}
@RequestMapping(value="/userIdentify", method=RequestMethod.POST)
public List userIdentify(@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "id", required = true) String id,
@RequestParam(value = "account", required = true) String account) {
return userClient.userIdentify(name, id, account);
}
@RequestMapping(value="/queryUserInfo", method=RequestMethod.POST)
public List queryUserInfo(@RequestParam(value="account") String account){
return userClient.queryUserInfo(account);
}
@RequestMapping(value="/queryUserIdentify", method=RequestMethod.POST)
public List queryUserIdentify(){
return userClient.queryUserIdentify();
}
@RequestMapping(value="/userBindBank", method=RequestMethod.POST)
public List userBindBank(@RequestParam(value = "num") String num,
@RequestParam(value = "bankname") String bankname,
@RequestParam(value = "type") String type,
@RequestParam(value = "code") String code,
@RequestParam(value = "userid") String userid){
return userClient.userBindBank(num, bankname, type, code, userid);
}
@RequestMapping(value="/userBindBank2", method=RequestMethod.POST)
public List userBindBank2(
@RequestParam(value = "num", required = true) String num,
@RequestParam(value = "tel", required = true) String tel,
@RequestParam(value = "id", required = true) String id,
@RequestParam(value = "code", required = true) String code,
@RequestParam(value = "userid") String userid){
List<Map<String,Object>> list = accountClient.queryBank(num, tel, id, code);
List<Map<String, Object>> relist = new ArrayList<Map<String, Object>>();
if(!list.isEmpty()){
for(Map<String,Object>map: list ){
System.out.println(map.get("code"));
int respcode = (int) map.get("code");
if(respcode==200){
Map<String,Object>datamap = (Map<String, Object>) map.get("data");
System.out.println(map.get("data"));
String bankname = (String) datamap.get("bank_name");
String type = (String) datamap.get("type");
System.out.println(datamap);
return userClient.userBindBank(num, bankname, type, code, userid);
}else{
return list;
}
}
}else{
Map<String, Object> remap = new HashMap<String, Object>();
remap.put("code", 400);
remap.put("msg", "绑定失败!");
relist.add(remap);
return relist;
}
return relist;
}
@RequestMapping(value="/queryBankBindCard", method=RequestMethod.POST)
public List queryBankBindCard(@RequestParam(value = "userid") String userid){
return userClient.queryBankBindCard(userid);
}
}
|
package com.java.practice.array;
/**
* You are in charge of the cake for a child's birthday.
* You have decided the cake will have one candle for each year of their total age.
* They will only be able to blow out the tallest of the candles. Count how many candles are tallest.
* <p>
* Example
* <p>
* <p>
* The maximum height candles are units high. There are of them, so return .
*/
public class TallestCandle {
public static void main(String[] args) {
int[] arr = {2, 2, 1, 1, 2, 4, 4, 4, 3};
System.out.println(birthdayCakeCandles(arr));
}
public static int birthdayCakeCandles(int[] ar) {
int tallest = ar[0];
//assume atleast there is 1 tallest candle
int cnt = 1;
for (int i = 1; i < ar.length; i++) {
//If encounter next tallest then reset counter
if (tallest < ar[i]) {
tallest = ar[i];
cnt = 0;
}
//check if there is multiple tallest
if (tallest == ar[i]) {
cnt++;
}
}
return cnt;
}
}
|
package com.meetingapp.android.model;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.firebase.database.Exclude;
public class BlockContact implements Parcelable {
private String name;
private String phone;
public BlockContact(String name, String phone) {
this.name = name;
this.phone = phone.replace(" ", "");
}
public BlockContact() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone.replace(" ", "");
}
@Override
public String toString() {
return name;
}
@Override
public int hashCode() {
return phone.hashCode();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.name);
dest.writeString(this.phone);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof BlockContact) {
return ((BlockContact) obj).getPhone().equals(phone) && ((BlockContact) obj).getName().equals(name);
} else {
return super.equals(obj);
}
}
protected BlockContact(Parcel in) {
this.name = in.readString();
this.phone = in.readString();
}
public static final Creator<BlockContact> CREATOR = new Creator<BlockContact>() {
@Override
public BlockContact createFromParcel(Parcel source) {
return new BlockContact(source);
}
@Override
public BlockContact[] newArray(int size) {
return new BlockContact[size];
}
};
}
|
package che.bean;
public class ConvertedBean {
private String msu;
private String msuUrl;
private String rap;
private String rapUrl;
private String rapVariants;
private String rapVariantsUrl;
private String rapSequence;
public String getMsu() {
return msu;
}
public void setMsu(String msu) {
this.msu = msu;
}
public String getMsuUrl() {
return msuUrl;
}
public void setMsuUrl(String msuUrl) {
this.msuUrl = msuUrl;
}
public String getRap() {
return rap;
}
public void setRap(String rap) {
this.rap = rap;
}
public String getRapUrl() {
return rapUrl;
}
public void setRapUrl(String rapUrl) {
this.rapUrl = rapUrl;
}
public String getRapVariants() {
return rapVariants;
}
public void setRapVariants(String rapVariants) {
this.rapVariants = rapVariants;
}
public String getRapVariantsUrl() {
return rapVariantsUrl;
}
public void setRapVariantsUrl(String rapVariantsUrl) {
this.rapVariantsUrl = rapVariantsUrl;
}
public String getRapSequence() {
return rapSequence;
}
public void setRapSequence(String rapSequence) {
this.rapSequence = rapSequence;
}
}
|
package ai.maum.sample_android;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.HashMap;
import java.util.Map;
import okhttp3.ResponseBody;
public class Utils {
final static String TAG = "Utils";
/* ============================================================================================== */
/*
** 보안이 요구되는 정보는 META-DATA를 이용한다.
*/
public static String getMetaData(Context context, String name) {
String value = null;
try {
String e = context.getPackageName();
ApplicationInfo ai = context
.getPackageManager()
.getApplicationInfo(e, PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
if(bundle != null) {
value = bundle.getString(name);
}
} catch (Exception e) { }
return value;
}
/* ============================================================================================== */
public static String rebuildJson(String json) {
String result = json.replace("{", "{\n");
result = result.replace("}", "\n}");
result = result.replace(",", ",\n");
return result;
}
public static Map<String, Object> jsonString2Map(String jsonString) {
HashMap<String, Object> map = null;
try {
map = new Gson().fromJson(jsonString, new TypeToken<HashMap<String, Object>>() {}.getType());
} catch (Exception e) {
Log.e("AAA", e.toString());
Log.e("AAA", e.getMessage());
e.printStackTrace();
}
return map;
}
/* ============================================================================================== */
public static boolean writeResponseBodyToDisk(ResponseBody body, String filepath) {
try {
File file = new File(filepath);
/* 폴더 생성 */
File dir = new File(file.getParent());
dir.mkdirs();
dir = null;
InputStream inputStream = null;
OutputStream outputStream = null;
try {
byte[] fileReader = new byte[4096];
long fileSize = body.contentLength();
long fileSizeDownloaded = 0;
inputStream = body.byteStream();
outputStream = new FileOutputStream(file);
while (true) {
int read = inputStream.read(fileReader);
if (read == -1) {
break;
}
outputStream.write(fileReader, 0, read);
fileSizeDownloaded += read;
Log.d(TAG, "file download: " + fileSizeDownloaded + " of " + fileSize);
}
outputStream.flush();
return true;
} catch (IOException e) {
return false;
} finally {
if (inputStream != null) inputStream.close();
if (outputStream != null) outputStream.close();
}
} catch (IOException e) {
return false;
}
}
public static void writeWavHeader(FileOutputStream out, short channels, int sampleRate, short bitDepth) throws IOException {
// WAV 포맷에 필요한 little endian 포맷으로 다중 바이트의 수를 raw byte로 변환한다.
byte[] littleBytes = ByteBuffer
.allocate(14)
.order(ByteOrder.LITTLE_ENDIAN)
.putShort(channels)
.putInt(sampleRate)
.putInt(sampleRate * channels * (bitDepth / 8))
.putShort((short) (channels * (bitDepth / 8)))
.putShort(bitDepth)
.array();
// 최고를 생성하지는 않겠지만, 적어도 쉽게만 가자.
out.write(new byte[]{
'R', 'I', 'F', 'F', // Chunk ID
0, 0, 0, 0, // Chunk Size (나중에 업데이트 될것)
'W', 'A', 'V', 'E', // Format
'f', 'm', 't', ' ', //Chunk ID
16, 0, 0, 0, // Chunk Size
1, 0, // AudioFormat
littleBytes[0], littleBytes[1], // Num of Channels
littleBytes[2], littleBytes[3], littleBytes[4], littleBytes[5], // SampleRate
littleBytes[6], littleBytes[7], littleBytes[8], littleBytes[9], // Byte Rate
littleBytes[10], littleBytes[11], // Block Align
littleBytes[12], littleBytes[13], // Bits Per Sample
'd', 'a', 't', 'a', // Chunk ID
0, 0, 0, 0, //Chunk Size (나중에 업데이트 될 것)
});
}
public static void updateWavHeader(File wav) throws IOException {
byte[] sizes = ByteBuffer
.allocate(8)
.order(ByteOrder.LITTLE_ENDIAN)
// 아마 이 두 개를 계산할 때 좀 더 좋은 방법이 있을거라 생각하지만..
.putInt((int) (wav.length() - 8)) // ChunkSize
.putInt((int) (wav.length() - 44)) // Chunk Size
.array();
RandomAccessFile accessWave = null;
try {
accessWave = new RandomAccessFile(wav, "rw"); // 읽기-쓰기 모드로 인스턴스 생성
// ChunkSize
accessWave.seek(4); // 4바이트 지점으로 가서
accessWave.write(sizes, 0, 4); // 사이즈 채움
// Chunk Size
accessWave.seek(40); // 40바이트 지점으로 가서
accessWave.write(sizes, 4, 4); // 채움
} catch (IOException ex) {
// 예외를 다시 던지나, finally 에서 닫을 수 있음
throw ex;
} finally {
if (accessWave != null) {
try {
accessWave.close();
} catch (IOException ex) {
// 무시
}
}
}
}
/* ============================================================================================ */
// UI 관련 유틸
/* ============================================================================================ */
public static void fullscreen(Activity act) {
View decorView = act.getWindow().getDecorView();
int uiOption = act.getWindow().getDecorView().getSystemUiVisibility();
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH )
uiOption |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN )
uiOption |= View.SYSTEM_UI_FLAG_FULLSCREEN;
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT )
uiOption |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility( uiOption );
}
/* ============================================================================================ */
// 이미지 관련
/* ============================================================================================ */
/*
** 비트맵을 PNG 파일로 저장
*/
public static void saveBitmapAsPngFile(Bitmap bitmap, String filepath) {
File file = new File(filepath);
OutputStream os = null;
try {
file.createNewFile();
os = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 80, os);
os.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} |
package com.sinodynamic.hkgta.dao.crm;
import com.sinodynamic.hkgta.dao.IBaseDao;
import com.sinodynamic.hkgta.entity.crm.PresentMaterialSeq;
public interface PresentMaterialSeqDao extends IBaseDao<PresentMaterialSeq> {
public boolean saveOrUpdatePMS(PresentMaterialSeq pms);
public int getPresentSeq(Long materialId,Long presentId);
}
|
package com.lucianoscilletta.battleship;
import java.util.*;
import java.io.*;
import java.awt.*;
import com.lucianoscilletta.battleship.graphics.*;
public class Ship implements Serializable{
private int length = 0;
private int x = 0;
private int y = 0;
private int health = 100;
private int hits = 0;
private int hitPoints = length;
private Boolean sunk = false;
private Boolean horizontal = true;
private ArrayList<GameCoordinate> coords = new ArrayList<GameCoordinate>();
public Ship(int x, int y, int length, Boolean horizontal){
this.length = length;
this.horizontal = horizontal;
this.x = x;
this.y = y;
for (int i = 0; i < length; i++){
if (horizontal){
this.coords.add(new GameCoordinate(x + i, y));
} else {
this.coords.add(new GameCoordinate(x, y + i));
}
}
this.hitPoints = length;
}
public void hit(){
if (hits < length){
hits++;
health = (100 * (length - hits)) / length;
}
if (0 == health){
sunk = true;
}
hitPoints = length - hits;
}
public Boolean isSunk(){
return sunk;
}
public int getX(){
return x;
}
public int getY(){
return y;
}
public int getHealth(){
return health;
}
public ArrayList<GameCoordinate> getCoords(){
return coords;
}
public int getLength(){
return length;
}
public int getHitPoints(){
return hitPoints;
}
public Boolean isHorizontal(){
return horizontal;
}
public void paint(Graphics2D g, float squareX, float squareY){
float border = (float)0.2;
int x0 = Math.round(coords.get(0).getX() * squareX);
int y0 = Math.round(coords.get(0).getY() * squareY);
int sx0 = Math.round(squareX*border);
int sy0 = Math.round(squareY * border);
g.setColor(GameColors.friendly[length-1][hitPoints]);
if (horizontal){
if (1 == length){
g.fillRect(x0 + sx0, y0 + sy0, Math.round(squareX-(2*sx0)), Math.round(squareY-(2*sy0)));
} else {
g.fillRect(x0 + sx0, y0 + sy0, Math.round(squareX-sx0), Math.round(squareY-(2*sy0)));
g.fillRect(x0 + Math.round(squareX * (length - 1)), y0 + sy0, Math.round(squareX-sx0), Math.round(squareY-(2*sy0)));
}
for (int i = 1; i < length-1; i++){
g.fillRect(x0 + (int)Math.floor(i * squareX), y0 + sy0, (int)Math.ceil(squareX), Math.round(squareY-(2*sy0)));
}
} else {
if (1 == length){
g.fillRect(x0 + sx0, y0 + sy0, Math.round(squareX-(2*sx0)), Math.round(squareY-(2*sy0)));
} else {
g.fillRect(x0 + sx0, y0 + sy0, Math.round(squareX-(2*sx0)), Math.round(squareY-sy0));
g.fillRect(x0 + sx0, y0 + Math.round(squareY * (length - 1)), Math.round(squareX-(2*sx0)), Math.round(squareY-sy0));
}
for (int i = 1; i < length-1; i++){
g.fillRect(x0 + sx0, y0 + (int)Math.floor(i * squareY), Math.round(squareX-(2*sx0)), (int)Math.ceil(squareY));
}
}
}
} |
package com.atguigu.lgl;
/*
* 要求:(1)创建Person类的对象,设置该对象的name、age和sex属性,
* 调用study方法,输出字符串“studying”,
* 调用showAge()方法显示age值,
* 调用addAge()方法给对象的age属性值增加2岁。
(2)创建第二个对象,执行上述操作,体会同一个类的不同对象之间的关系。
*/
public class PersonTest_Luo {
public static void main(String[] args) {
Person5 p1 = new Person5();
p1.age = 18;
p1.study();
p1.showAge();
p1.addAge(8);
p1.showAge();
}
}
class Person5{
String name;
int age;
int sex;
public void study(){
System.out.println("studying...");
}
public void showAge(){
System.out.println("age = " + age);
}
public int addAge(int i){
age += i;
return age;
}
} |
package edu.colostate.cs.cs414.soggyZebras.rollerball.Client.menu;
import edu.colostate.cs.cs414.soggyZebras.rollerball.Client.menu.listdisplay.PastGameListDisplay;
import edu.colostate.cs.cs414.soggyZebras.rollerball.Game.Game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
public class ProfilePanel extends MenuPanel {
public ProfilePanel(MenuGUI menuGUI) {
super("profile", menuGUI);
}
@Override
public void refresh() {
removeAll();
add(new JLabel("<html>Profile<br>Username: " + getMenuGUI().loggedInUser.getUsername()
+ "<br>Email: " + getMenuGUI().loggedInUser.getEmail() + "<br>Game History: </html>"));
int wins = 0;
int losses = 0;
DefaultListModel<PastGameListDisplay> pastGameModel = new DefaultListModel();
// load won games into list
for (Game game : getMenuGUI().loggedInUser.getGames()) {
if (game.getWinner() != null) {
if (game.getWinner().getUserID() == getMenuGUI().loggedInUser.getUserID()) {
wins++;
}
else {
losses++;
}
pastGameModel.addElement(new PastGameListDisplay(game, getMenuGUI().loggedInUser.getUsername()));
}
}
JList<PastGameListDisplay> pastGameList = new JList<>(pastGameModel);
JScrollPane listScroller = new JScrollPane(pastGameList);
listScroller.setPreferredSize(new Dimension(250, 100));
add(listScroller);
add(new JLabel("<html>Wins: " + wins + "<br>Losses: " + losses + "<br></html>"));
add(createLinkedActionButton("Logout", new LogoutListener()));
add(createLinkedActionButton("Unregister", new UnregisterListener()));
add(createLinkedButton("Back", "main_menu"));
}
class LogoutListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
int logout = JOptionPane.showOptionDialog(getMenuGUI(),
"Are you sure you want to logout?", "Logout Confirmation",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
if (logout == 0) {
try {
getMenuGUI().client.logout(getMenuGUI().loggedInUser.getUserID());
}
catch(IOException i){
i.printStackTrace();
}
getMenuGUI().setMenu("register_login");
}
}
}
class UnregisterListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
int unreg = JOptionPane.showOptionDialog(getMenuGUI(),
"Are you sure you want to unregister? All of this user's data will be lost", "Unregister Confirmation",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
if (unreg == 0) {
// TODO: unregister user from db
try {
getMenuGUI().client.deregister(getMenuGUI().loggedInUser.getUserID());
}
catch(IOException i){
i.printStackTrace();
}
getMenuGUI().setMenu("register_login");
}
}
}
}
|
package com.homegroup.incomecounter.models.metadata;
import com.homegroup.incomecounter.models.SpendingCategory;
import javax.annotation.processing.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
import java.util.UUID;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(SpendingCategory.class)
public class SpendingCategory_ {
public static volatile SingularAttribute<SpendingCategory, UUID> id;
public static volatile SingularAttribute<SpendingCategory, String> name;
public static final String ID = "id";
public static final String NAME = "name";
} |
package com.bits.farheen.dhun;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bits.farheen.dhun.misc.SettingsActivity;
import com.bits.farheen.dhun.music.albums.AlbumDetailsFragment;
import com.bits.farheen.dhun.music.artists.ArtistDetailsFragment;
import com.bits.farheen.dhun.events.PauseMusic;
import com.bits.farheen.dhun.events.PlayStatusChange;
import com.bits.farheen.dhun.events.PositionChange;
import com.bits.farheen.dhun.events.QueueChange;
import com.bits.farheen.dhun.models.AlbumModel;
import com.bits.farheen.dhun.models.ArtistModel;
import com.bits.farheen.dhun.models.SongsModel;
import com.bits.farheen.dhun.nowplaying.NowPlayingActivity;
import com.bits.farheen.dhun.utils.Constants;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.lang.reflect.Type;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MainActivity extends AppCompatActivity {
@BindView(R.id.toolbar_main_activity) Toolbar toolbar;
@BindView(R.id.text_song_name) TextView textSongName;
@BindView(R.id.text_song_artist) TextView textSongArtist;
@BindView(R.id.image_play_pause) ImageView imagePlayPause;
@BindView(R.id.frag_container) FrameLayout fragContainer;
@BindView(R.id.bottom_view) View bottomView;
private Gson gson;
private Context mContext;
private SharedPreferences dataFile;
private FragmentManager fragmentManager;
private static final String TAG = "MainActivity";
private int currentPlayingPosition;
private ArrayList<SongsModel> currentQueue;
private Type songListType = new TypeToken<ArrayList<SongsModel>>(){}.getType();
@SuppressLint("InlinedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
mContext = this;
gson = new Gson();
setSupportActionBar(toolbar);
fragmentManager = getSupportFragmentManager();
dataFile = getSharedPreferences(Constants.DATA_FILE, MODE_PRIVATE);
if(ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
Constants.READ_EXTERNAL_STORAGE_REQUEST_CODE);
}
else {
initViews();
}
initListeners();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.action_settings :
startActivity(new Intent(this, SettingsActivity.class));
return true;
default :
return super.onOptionsItemSelected(item);
}
}
@Override
protected void onStart() {
super.onStart();
currentQueue = gson.fromJson(dataFile.getString(Constants.CURRENT_MUSIC_QUEUE, null), songListType);
currentPlayingPosition = dataFile.getInt(Constants.LAST_PLAYED_POSITION, 0);
if(currentQueue == null){
bottomView.setVisibility(View.GONE);
}
else {
bottomView.setVisibility(View.VISIBLE);
updateBottomView(dataFile.getBoolean(Constants.IS_MUSIC_PLAYING, false));
}
EventBus.getDefault().register(this);
}
@Override
protected void onStop() {
EventBus.getDefault().unregister(this);
super.onStop();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(requestCode == Constants.READ_EXTERNAL_STORAGE_REQUEST_CODE){
if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
initViews();
}
else {
Toast.makeText(getApplicationContext(), "Permission Needed", Toast.LENGTH_SHORT).show();
}
}
}
void initListeners(){
imagePlayPause.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// If music is playing then pause it
if(dataFile.getBoolean(Constants.IS_MUSIC_PLAYING, false)){
EventBus.getDefault().post(new PauseMusic());
imagePlayPause.setImageResource(R.drawable.play);
}
else {
Intent playMusicIntent = new Intent(mContext, PlayMusicService.class)
.putExtra(Constants.CURRENT_MUSIC_QUEUE, gson.toJson(currentQueue, songListType))
.putExtra(Constants.POSITION_TO_PLAY, currentPlayingPosition)
.putExtra(Constants.PLAYBACK_TYPE, Constants.PLAYBACK_RESUME);
startService(playMusicIntent);
imagePlayPause.setImageResource(R.drawable.pause);
}
}
});
bottomView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent nowPlayingIntent = new Intent(mContext, NowPlayingActivity.class);
startActivity(nowPlayingIntent);
}
});
}
void initViews(){
}
public void updateBottomView(boolean isMusicPlaying){
textSongName.setText(currentQueue.get(currentPlayingPosition).getTitle());
textSongArtist.setText(currentQueue.get(currentPlayingPosition).getArtist());
if(isMusicPlaying){
imagePlayPause.setImageResource(R.drawable.pause);
}
else {
imagePlayPause.setImageResource(R.drawable.play);
}
}
@Subscribe
public void onQueueChange(QueueChange queueChange){
currentQueue = queueChange.getQueue();
currentPlayingPosition = queueChange.getPositionToPlay();
updateBottomView(true);
}
@Subscribe
public void onPositionChange(PositionChange positionChange){
currentPlayingPosition = positionChange.getPosition();
updateBottomView(true);
}
@Subscribe
public void onPlayStatusChange(PlayStatusChange playStatusChange){
updateBottomView(playStatusChange.isPlaying());
}
@Subscribe
public void openAlbumDetails(AlbumModel album){
Bundle albumBundle = new Bundle();
albumBundle.putString(Constants.ALBUM_KEY, album.getKey());
albumBundle.putInt(Constants.NUM_SONGS, album.getNumSongs());
albumBundle.putString(Constants.ALBUM_NAME, album.getName());
albumBundle.putString(Constants.ALBUM_ART, album.getAlbumArt());
AlbumDetailsFragment albumDetailsFragment = new AlbumDetailsFragment();
albumDetailsFragment.setArguments(albumBundle);
fragmentManager.beginTransaction()
.setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
.add(R.id.frag_container, albumDetailsFragment)
.addToBackStack(null)
.commit();
}
@Subscribe
public void openArtistDetails(ArtistModel artist){
Bundle artistBundle = new Bundle();
artistBundle.putString(Constants.ARTIST_KEY, artist.getKey());
artistBundle.putString(Constants.ARTIST_NAME, artist.getArtist());
ArtistDetailsFragment artistDetailsFragment = new ArtistDetailsFragment();
artistDetailsFragment.setArguments(artistBundle);
fragmentManager.beginTransaction()
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
.add(R.id.frag_container, artistDetailsFragment)
.addToBackStack(null)
.commit();
}
}
|
package com.nineleaps.onlinecoding;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Solution {
public static void main(String args[]) throws Exception {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
Scanner sc = new Scanner(System.in);
String sub = sc.nextLine();
int t = Integer.parseInt(sub);
ArrayList<Account> list = new ArrayList<Account>();
for (int i = 0; i < t; i++) {
String[] input = sc.nextLine().split(" ");
list.add(new Account(input[0], Integer.parseInt(input[1]), Integer.parseInt(input[2])));
}
Collections.sort(list);
System.out.println("Most valuable account details:");
System.out.println(list.get(list.size() - 1));
}
} |
package com.yukai.monash.student_seek;
public class activejobs_model {
private String employerid;
private String jobid;
private String jobdesc;
private String companyPicFile;
public String getEmployerid() {
return employerid;
}
public void setEmployerid(String employerid) {
this.employerid = employerid;
}
public String getJobid() {
return jobid;
}
public void setJobid(String jobid) {
this.jobid = jobid;
}
public String getJobdesc() {
return jobdesc;
}
public void setJobdesc(String jobdesc) {
this.jobdesc = jobdesc;
}
public String getCompanyPicFile () {
return companyPicFile;
}
public void setCompanyPicFile(String companyPicFile) {
this.companyPicFile = companyPicFile;
}
}
|
package org.kohsuke.bookart;
import org.apache.commons.io.IOUtils;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
/**
* @author Kohsuke Kawaguchi
*/
public class Main {
@Argument(required=true,index=0)
public File image;
@Argument(required=true,index=1)
public int slices;
@Option(name="-s",usage="If the page doesn't begin by 0")
public int start;
@Option(name="-p",usage="Height of a page")
public float pageHeight;
@Option(name="-h",usage="Height of the image")
public float imageHeight;
private BufferedImage canvas;
public static void main(String[] args) throws Exception {
new Main().run(args);
}
private void run(String[] args) throws Exception {
new CmdLineParser(this).parseArgument(args);
canvas = ImageIO.read(image);
StringBuilder instructions = new StringBuilder();
for (int i=0; i<slices; i++) {
final int x = (canvas.getWidth()*i)/slices;
// scan a line and find edges
List<Float> edges = findEdges(x);
noiseReduction(edges);
instructions.append("<div>Page ").append(i*2+start).append(": ");
for (int j=0; j<edges.size(); j++) {
if (j>0) instructions.append(", ");
if (j%2==0) instructions.append("<div>(");
instructions.append(edges.get(j));
if (j%2==1) instructions.append(")</div>");
}
instructions.append("</div>");
String html = IOUtils.toString(Main.class.getResourceAsStream("/main.html"))
.replace("${body}",instructions);
File txt = new File(image.getPath() + ".html");
try (Writer w = new OutputStreamWriter(new FileOutputStream(txt),"UTF-8")) {
w.write(html);
}
}
}
/**
* Very short 'up' region is not stable, so remove them.
*/
private void noiseReduction(List<Float> edges) {
for (int i=0; i<edges.size()-1; ) {
if (edges.get(i+1)-edges.get(i)<=0.1) {
edges.remove(i);
edges.remove(i);
} else {
i++;
}
}
}
/**
* Scans a vertical line and find all the edges.
*/
private List<Float> findEdges(int x) {
final List<Float> edges = new ArrayList<>();
final int h = canvas.getHeight();
final float topMargin = (pageHeight - imageHeight) / 2;
for (int y = 1; y< h; y++) {
if (bw(pick(x, y-1))
!= bw(pick(x, y))) {
edges.add(round(imageHeight*y/h+ topMargin));
}
}
return edges;
}
/**
* Round at the mm unit
*/
private float round(float f) {
return (float) (Math.round(f*10)/10.0);
}
private Color pick(int x, int y) {
return new Color(canvas.getRGB(x,y));
}
private boolean bw(Color c) {
return c.getBlue() + c.getRed() + c.getGreen() > 128*3;
}
}
|
package com.neu.spring;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.neu.spring.dao.TraderDao;
import com.neu.spring.pojo.UserAccount;
@Controller
public class LoginController {
@Autowired
@Qualifier("traderDao")
TraderDao traderDao;
@RequestMapping(value="/",method = RequestMethod.GET)
public String initializeForm() {
System.out.println("inside initilization");
return "loginform";
}
@RequestMapping(method=RequestMethod.POST,value="/login.htm")
public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
ModelAndView mv=new ModelAndView();
String userName = hsr.getParameter("userName");
String password = hsr.getParameter("password");
System.out.println("username" + userName);
//TraderDao traderDao=new TraderDao();
boolean result = traderDao.authenticateUser(userName, password);
UserAccount user = traderDao.getUserByUserName(userName);
System.out.println("result" +result);
if(result == true){
if(user.getRole().equalsIgnoreCase("Admin"))
{
hsr.getSession().setAttribute("user", user);
mv.addObject("userAccount", user);
mv.setViewName("adminhomepage");
}
else if (user.getRole().equalsIgnoreCase("Trader"))
{
hsr.getSession().setAttribute("user", user);
mv.addObject("userAccount", user);
mv.setViewName("traderpage");
}
}
//else{
// mv.setViewName("loginform");
// }
return mv;
}
}
|
package com.meehoo.biz.web.controller.basic.auth;
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
import com.meehoo.biz.common.util.StringUtil;
import com.meehoo.biz.core.basic.annotation.UnAop;
import com.meehoo.biz.core.basic.domain.security.Admin;
import com.meehoo.biz.core.basic.param.HttpResult;
import com.meehoo.biz.core.basic.service.security.IAdminService;
import com.meehoo.biz.core.basic.service.security.ILoginRecordService;
import com.meehoo.biz.core.basic.service.security.IUserService;
import com.meehoo.biz.core.basic.util.RedisTemplateService;
import com.meehoo.biz.core.basic.util.UserContextUtil;
import com.meehoo.biz.core.basic.vo.security.AdminVO;
import com.meehoo.biz.web.config.ApplicationValues;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.DisabledAccountException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.util.HashMap;
@Api(tags = "登录管理")
@Controller
@Slf4j
public class LoginController {
private final Producer captchaProducer;
@Value("${kaptcha.enable}")
private String enableKaptcha;
@Autowired
public LoginController(Producer captchaProducer) {
this.captchaProducer = captchaProducer;
}
/**
* 获取验证码
*/
@GetMapping(value = "getKaptchaImage")
@UnAop
public void getKaptchaImage(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setDateHeader("Expires", 0);
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
// return a jpeg
response.setContentType("image/jpeg");
// create the text for the image
String capText = captchaProducer.createText();
// store the text in the session
//request.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);
//将验证码存到session
request.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);
// create the image with the text
BufferedImage bi = captchaProducer.createImage(capText);
ServletOutputStream out = response.getOutputStream();
// write the data out
ImageIO.write(bi, "jpg", out);
try {
out.flush();
} finally {
out.close();
}
}
/**
* 异步校验验证码
*/
@PostMapping("/checkLoginValidateCode")
@ResponseBody
public HttpResult checkLoginValidateCode(HttpServletRequest request, String validateCode) {
String loginValidateCode = request.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY).toString();
if (loginValidateCode == null) {
return HttpResult.fail("验证码已过期");
} else if (!loginValidateCode.equals(validateCode)) {
return HttpResult.fail("验证码错误");
} else {
return HttpResult.fail("验证码正确");
}
}
/**
* 登录
*
* @param userName
* @param password
* @return
*/
@PostMapping("/login")
@ResponseBody
@UnAop
public HttpResult login(String userName, String password, String code, HttpServletRequest request) {
//校验验证码
if (!"false".equals(enableKaptcha)){
Object attribute = request.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
Assert.notNull(attribute,"验证码已过期");
String verificationCodeIn = String.valueOf(attribute);
request.getSession().removeAttribute(Constants.KAPTCHA_SESSION_KEY);
if (StringUtil.stringIsNull(verificationCodeIn) || !verificationCodeIn.equals(code)) {
throw new RuntimeException("验证码不正确");
}
}
// 账号密码校验
UsernamePasswordToken token = new UsernamePasswordToken(userName, password);
Subject subject = SecurityUtils.getSubject();
String msg = "";
try {
subject.login(token);
} catch (UnknownAccountException e) {
msg = "账号不存在!";
} catch (DisabledAccountException e) {
msg = "账号未启用!";
} catch (IncorrectCredentialsException e) {
msg = "密码错误!";
} catch (Throwable e) {
if (StringUtil.stringIsNull(e.getMessage())) {
msg = "未知错误!";
} else {
msg = e.getMessage();
}
}
log.info(msg);
if (subject.isAuthenticated() && StringUtil.stringIsNull(msg)) {
Admin admin = (Admin) SecurityUtils.getSubject().getPrincipal();
return HttpResult.success(new AdminVO(admin));
} else {
return HttpResult.fail(msg);
}
}
@GetMapping("/403")
public String unauthorized() {
log.info("------没有权限-------");
return "unauthorized";
}
} |
package org.kevoree.registry.service.mapper;
import org.kevoree.registry.domain.Namespace;
import org.kevoree.registry.domain.TypeDefinition;
import org.kevoree.registry.domain.User;
import org.kevoree.registry.service.dto.NamespaceDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Mapper for the entity Namespace and its DTO NamespaceDTO
*/
@Mapper(componentModel = "spring")
public abstract class NamespaceMapper {
@Mapping(source = "owner.login", target = "owner")
public abstract NamespaceDTO namespaceToNamespaceDTO(Namespace namespace);
@Mapping(source = "owner", target = "owner.login")
public abstract Namespace namespaceDTOtoNamespace(NamespaceDTO namespaceDTO);
public User stringToUser(String owner) {
User user = new User();
user.setLogin(owner);
return user;
}
public Set<String> stringsFromMembers(Set<User> members) {
return members.stream().map(User::getLogin)
.collect(Collectors.toSet());
}
public Set<User> membersFromStrings(Set<String> strings) {
return strings.stream().map(string -> {
User member = new User();
member.setLogin(string);
return member;
}).collect(Collectors.toSet());
}
public Set<Long> longsFromTypeDefinitions(Set<TypeDefinition> typeDefinitions) {
return typeDefinitions.stream().map(TypeDefinition::getId)
.collect(Collectors.toSet());
}
public Set<TypeDefinition> typeDefinitionsFromLongs(Set<Long> ids) {
return ids.stream().map(id -> {
TypeDefinition tdef = new TypeDefinition();
tdef.setId(id);
return tdef;
}).collect(Collectors.toSet());
}
}
|
public class Cheerleader implements Runnable {
public static void main(String args[]) {
Thread t1 = null;
Thread t2 = null;
Thread t3 = null;
try {
t1 = new Thread(new Cheerleader("Redskins",100));
t2 = new Thread(new Cheerleader("Cowboys",200));
t3 = new Thread(new Cheerleader("Steelers",50));
t1.start();
t2.start();
t3.start();
} catch (Exception e) {
e.printStackTrace();
}
try {
t3.join();
} catch (InterruptedException e) {
System.out.println("I was waiting on 3 and got whacked...");
}
t2.interrupt();
}
private String team;
private int delayMillis;
public Cheerleader(String team, int delayMillis) {
this.team = team;
this.delayMillis = delayMillis;
}
public void run() {
for (int i=0; i<5; i++) {
try {
Thread.currentThread().sleep(delayMillis);
} catch (InterruptedException e) {
System.out.println("FIRE!!!!");
}
System.out.println("Go " + team + "!!");
}
}
} |
public class PhysicalInfoMain {
public static void main(String[] args) {
PhysicalInfo obj;
obj = new PhysicalInfo("해리",10,132.0f,35.0f);
// printPhysicalInfo(obj);
obj.update(11,145.0f, 45.0f);
//printPhysicalInfo(obj);
obj.update(12,145.0f, 45.0f);
// printPhysicalInfo(obj);
}
static void printPhysicalInfo(PhysicalInfo obj){//printPhysicalInfo
System.out.println("이름" + obj.name);
System.out.println("나이" + obj.age);
System.out.println("키" + obj.height);
System.out.println("몸무게" + obj.weight);
System.out.println();
}
}
|
package com.example.administrator.panda_channel_app.MVP_Framework.module.home;
import android.content.Intent;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.administrator.panda_channel_app.MVP_Framework.base.BaseActivity;
import com.example.administrator.panda_channel_app.R;
import butterknife.BindView;
import butterknife.OnClick;
/**
* Created by Administrator on 2017/7/15 0015.
*/
public class WebviewActivity extends BaseActivity {
@BindView(R.id.activity_webview)
public WebView activityWebview;
@BindView(R.id.home_webview_back)
ImageView homeWebviewBack;
@BindView(R.id.home_webview_share)
ImageView homeWebviewShare;
@BindView(R.id.home_webview_title)
TextView homeWebviewTitle;
@Override
protected void initView() {
Intent intent = getIntent();
String url = intent.getStringExtra("url");
String title = intent.getStringExtra("title");
activityWebview.loadUrl(url);
activityWebview.setWebViewClient(new WebViewClient());
activityWebview.getSettings().setJavaScriptEnabled(true);
homeWebviewTitle.setText(title);
}
@Override
protected int getLayoutId() {
return R.layout.webviewactivity;
}
@OnClick({R.id.home_webview_back, R.id.home_webview_share})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.home_webview_back:
WebviewActivity.this.finish();
activityWebview.stopLoading();
activityWebview.destroy();
break;
case R.id.home_webview_share:
break;
}
}
}
|
package com.example.a77354.android_final_project.HttpServiceInterface;
import com.example.a77354.android_final_project.RequestBodyStruct.RegisterBody;
import com.example.a77354.android_final_project.ToolClass.ResponseBody;
import java.util.List;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
/**
* Created by kunzhai on 2018/1/5.
*/
public interface RegisterServiceInterface {
@Headers({"Content-Type: application/json","Accept: application/json"})
@POST("user/register")
rx.Observable<ResponseBody> register(@Body RequestBody registerBody);
}
|
package com.mabaya.test.web.rest;
import com.mabaya.test.domain.Campaign;
import com.mabaya.test.domain.Category;
import com.mabaya.test.domain.Product;
import com.mabaya.test.repository.CampaignRepository;
import com.mabaya.test.services.CampaignManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(value = "/serveAd")
@Slf4j
public class ServeAdController {
@Autowired
private CampaignManager campaignManager;
@RequestMapping(value="/{category}", method = RequestMethod.GET)
public ResponseEntity<Product> getAdd(@PathVariable("category") Category category) {
return campaignManager.getAd(category)
.map(product -> new ResponseEntity<Product>(product, HttpStatus.OK))
.orElse(ResponseEntity.notFound().build());
}
}
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Business;
import DataAccess.DishDAL;
import Entity.Dish;
import java.util.List;
/**
*
* @author TUNT
*/
public class DishBAL {
private static DishBAL instance;
public static DishBAL getInstance() {
if(instance == null) {
instance = new DishBAL();
}
return instance;
}
public List<Dish> getDishList(){
List<Dish> listAll = null;
try {
listAll= DishDAL.getInstance().getDishList();
} catch (Exception e) {
e.printStackTrace();
}
return listAll;
}
public void addDish(Dish dish){
try {
DishDAL.getInstance().addDish(dish);
} catch (Exception e) {
e.printStackTrace();
}
}
public void editDish(Dish dish){
try {
DishDAL.getInstance().editDish(dish);
} catch (Exception e) {
}
}
public List<Dish> getDishListByMenuID() {
List<Dish> list = null;
try {
list= DishDAL.getInstance().getDishListByMenuID();
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public void deleteDish(Dish dish) {
try {
DishDAL.getInstance().deleteDish(dish);
} catch (Exception e) {
e.printStackTrace();
}
}
public List<Dish> getDishListFastFoot() {
List<Dish> listAll = null;
try {
listAll= DishDAL.getInstance().getDishListFastFoot();
} catch (Exception e) {
e.printStackTrace();
}
return listAll;
}
}
|
package com.ceres.logdemo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@Slf4j
public class LogDemoApplication {
public static void main(String[] args) {
SpringApplication.run(LogDemoApplication.class, args);
log.debug("debug记录日志");
log.info("info记录日志");
}
}
|
package de.dikodam.adventofcode.day06;
import de.dikodam.adventofcode.tools.Tuple;
public class Coordinates extends Tuple<Integer, Integer> {
public Coordinates(Integer integer, Integer integer2) {
super(integer, integer2);
}
public Integer getX() {
return getA();
}
public Integer getY() {
return getB();
}
}
|
package com.example.demo.model;
import java.net.URL;
public class ChildCallResult extends CallResult {
private boolean internalLink;
public ChildCallResult(URL url) {
super(url);
}
public ChildCallResult() {
super();
}
public void setInternalLink(boolean internalLink) {
this.internalLink = internalLink;
}
public boolean isInternalLink() {
return internalLink;
}
}
|
package kr.co.shop.batch.order.model.master;
import kr.co.shop.batch.order.model.master.base.BaseOcOrderPayment;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Data
public class OcOrderPayment extends BaseOcOrderPayment {
}
|
package com.example.matt.termproject;
import android.annotation.TargetApi;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.os.Build;
import android.content.Context;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
private static final String TAG = "MainActivity";
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// custom logic for determining sandbox status
int confidence = 0; // the level of confidence that we are in a sandbox
Log.d(TAG, "Beginning API scan for emulation.");
// Removed the code below for low API revision compatibility (more target devices)
// Build properties
// looking for armeabi or unknown; likely
//for( int i = 0; i < Build.SUPPORTED_ABIS.length; i++) {
// Log.d(TAG, "Supported ABI: " + Build.SUPPORTED_ABIS[i]);
// if(Build.SUPPORTED_ABIS[i].equals("armeabi") || Build.SUPPORTED_ABIS[i].equals("unknown"))
// confidence += 40;
//}
// looking for unknown board; very certain
if(Build.BOARD.equals("unknown"))
confidence += 50;
// generic brand; very certain
if(Build.BRAND.equals("generic"))
confidence += 50;
// generic device; very certain
if(Build.DEVICE.equals("generic"))
confidence += 50;
// generic prefix fingerprint; very certain
if(Build.FINGERPRINT.startsWith("generic"))
confidence += 50;
// goldfish hardware; very certain
if(Build.HARDWARE.equals("goldfish"))
confidence += 50;
// android-test prefix host; likely
if(Build.HOST.startsWith("android-test"))
confidence += 40;
// FRF91 ID; very certain
if(Build.ID.equals("FRF91"))
confidence += 50;
// unknown manufacturer; very certain
if(Build.MANUFACTURER.equals("unknown"))
confidence += 50;
// sdk model; very certain
if(Build.MODEL.equals("sdk"))
confidence += 50;
// sdk product; very certain
if(Build.PRODUCT.equals("sdk"))
confidence += 50;
// unknown radio; very certain
if(Build.RADIO.equals("unknown"))
confidence += 50;
// null serial; very certain
if(Build.SERIAL.equals("null"))
confidence += 50;
// test-keys tags; very certain
if(Build.TAGS.equals("test-keys"))
confidence += 50;
// android-build user; very certain
if(Build.USER.equals("android-builder"))
confidence += 50;
// TelephonyManager methods
TelephonyManager telMan = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE));
// regular expression matching a string of all zeroes
if(telMan.getDeviceId().matches("^[0]+$"))
confidence += 50;
// check the telephone number prefix
if(telMan.getLine1Number().startsWith("155552155"))
confidence += 50;
// check the network country ISO
if(telMan.getNetworkCountryIso().equals("us"))
confidence += 10;
if(telMan.getNetworkType() == 3) // edge
confidence += 10;
if(telMan.getNetworkOperator().startsWith("310"))
confidence += 10;
if(telMan.getNetworkOperator().substring(3).startsWith("260"))
confidence += 10;
if(telMan.getPhoneType() == 1) // gsm
confidence += 10;
if(telMan.getSimCountryIso().equals("us"))
confidence += 10;
if(telMan.getSimSerialNumber().equals("89014103211118510720"))
confidence += 15;
if(telMan.getSubscriberId().startsWith("310260000000000"))
confidence += 50;
if(telMan.getVoiceMailNumber().equals("15552175049"))
confidence += 50;
//Log.d(TAG, "Total confidence: " + confidence);
setContentView(R.layout.activity_main);
TextView txtView = (TextView)findViewById(R.id.hello_world);
//txtView.setText("Total confidence: " + Integer.toString(confidence));
if(confidence > 150)
txtView.setText("Benign execution path");
// call harmless application activity
else
txtView.setText("Malicious execution path");
// call malicious application activity
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
package vnfoss2010.smartshop.serverside.database.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.beoui.geocell.model.LocationCapable;
import com.beoui.geocell.model.Point;
import com.google.gson.annotations.Exclude;
@PersistenceCapable
public class UserSubcribeProduct implements LocationCapable, Cloneable {
private static final long serialVersionUID = 1L;
private static final int EMAIL = 0;
private static final int SMS = 1;
private static final int PUSH_NOTIFICATION = 2;
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private Double lat;
@Persistent
private Double lng;
@Persistent
private Double radius;
@Persistent
private String description;
@Persistent
private boolean isActive = true;
@Persistent
private Date date;
@Persistent
@Exclude
private String username;
@Persistent
private List<String> categoryList;
@Persistent
private String q;
@Persistent
private int type_notification;
private boolean isNew;
@Persistent
@Exclude
private List<String> geocells;
public UserSubcribeProduct() {
}
public UserSubcribeProduct(String userName, Double lat, Double lng,
Double radius, boolean isActive, Date date, String description,
String keyword, int type) {
this.lat = lat;
this.lng = lng;
this.radius = radius;
this.description = description;
this.isActive = isActive;
this.date = date;
this.username = userName;
this.q = keyword;
this.type_notification = type;
categoryList = new ArrayList<String>();
}
public Double getRadius() {
return radius;
}
public void setRadius(Double radius) {
this.radius = radius;
}
public void setGeocells(List<String> geocells) {
this.geocells = geocells;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = lng;
}
public List<String> getCategoryList() {
return categoryList;
}
public void setCategoryList(List<String> categoryList) {
this.categoryList = categoryList;
}
public Long getId() {
return id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
@Override
public List<String> getGeocells() {
return geocells;
}
@Override
public String getKeyString() {
return id + "";
}
@Override
public Point getLocation() {
return new Point(lat, lng);
}
/**
* @param keyword
* the keyword to set
*/
public void setKeyword(String keyword) {
this.q = keyword;
}
/**
* @return the keyword
*/
public String getKeyword() {
return q;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "UserSubcribeProduct [categoryList=" + categoryList + ", date="
+ date + ", description=" + description + ", geocells="
+ geocells + ", id=" + id + ", isActive=" + isActive
+ ", keyword=" + q + ", lat=" + lat + ", lng=" + lng
+ ", radius=" + radius + ", userName=" + username + "]";
}
/**
* @param type_notification
* the type_notification to set
*/
public void setType_notification(int type_notification) {
this.type_notification = type_notification;
}
/**
* @return the type_notification
*/
public int getType_notification() {
return type_notification;
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
return null;
}
}
/**
* @param isNew
* the isNew
* <ul>
* <li>true: if there have any new products in the list
* <li>false: otherwise
* </ul>
*/
public void setNew(boolean isNew) {
this.isNew = isNew;
}
/**
* @return the isNew
*/
public boolean isNew() {
return isNew;
}
private String toBinaryString() {
String tmp = Integer.toBinaryString(type_notification);
for (int i = tmp.length(); i < 3; i++) {
tmp = "0" + tmp;
}
return tmp;
}
public boolean isSendMail() {
if (toBinaryString().charAt(3 - 1 - EMAIL) == '1')
return true;
return false;
}
public boolean isSendSMS() {
if (toBinaryString().charAt(3 - 1 - SMS) == '1')
return true;
return false;
}
public boolean isPushNotification() {
if (toBinaryString().charAt(3 - 1 - PUSH_NOTIFICATION) == '1')
return true;
return false;
}
public static void main(String[] args) {
UserSubcribeProduct u = new UserSubcribeProduct();
u.type_notification = 1 | 4;
System.out.println(u.type_notification + " "
+ Integer.toBinaryString(u.type_notification));
System.out.println(u.isSendMail() + " " + u.isSendSMS() + " "
+ u.isPushNotification());
}
}
|
package br.com.juliafealves.agenda.ui.activities;
import android.app.AlertDialog;
import android.content.Context;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.ListView;
import br.com.juliafealves.agenda.daos.StudentDAO;
import br.com.juliafealves.agenda.models.Student;
import br.com.juliafealves.agenda.ui.adapters.StudentListAdapter;
public class StudentListView {
private final Context context;
private final StudentDAO dao;
private final StudentListAdapter adapter;
public StudentListView(Context context) {
this.context = context;
this.dao = new StudentDAO();
this.adapter = new StudentListAdapter(context);
}
public void configureStudentListAdapter(ListView listView) {
listView.setAdapter(adapter);
}
public void confirmRemove(final MenuItem item) {
new AlertDialog
.Builder(context)
.setTitle("Removing student...")
.setMessage("Are you sure you want to remove the student?")
.setPositiveButton("Yes", (dialog, which) -> {
AdapterView.AdapterContextMenuInfo menuInfo =
(AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
Student student = adapter.getItem(menuInfo.position);
remove(student);
})
.setNegativeButton("No", null)
.show();
}
public void refreshList() {
adapter.refresh(dao.findAll());
}
private void remove(Student student) {
dao.removeById(student.getId());
adapter.remove(student);
}
}
|
package lotro.my.reports;
import gui.ButtonGroup;
import gui.ComponentTools;
import java.awt.Component;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;
import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import utils.ImageTools;
public class ReportSelector
{
private ButtonGroup buttons;
private ActionListener listener;
private ActionListener iconUpdater;
private JPanel panel;
private Map<AbstractButton, Icon> icons = new HashMap<AbstractButton, Icon>();
public ReportSelector (final ActionListener listener)
{
this.listener = listener;
iconUpdater = new IconUpdater();
panel = new JPanel();
buttons = new ButtonGroup();
buttons.setMaxSelectable (1);
addButton ("Classes", "20/gui/GraphPie.gif", "A pie chart by character class");
addButton ("Class/Level", "20/gui/GraphBar.gif", "A bar chart by class and level");
addButton ("Roster", "20/people/Users.gif", "A simple roster table");
addButton ("Stats", "20/documents/DocumentList.gif", "A table showing character stats");
addButton ("Crafters", "20/objects/Hammer.gif", "A table showing all Master Crafters");
addButton ("Equipment", "20/map/COA.gif", "A table showing all Equipped Gear");
}
private JRadioButton addButton (final String label, final String iconFile,
final String toolTip)
{
JRadioButton button = new JRadioButton (label, false);
button.setMargin (new Insets (0, 0, 0, 0));
button.setToolTipText (toolTip);
button.addActionListener (iconUpdater);
if (listener != null)
button.addActionListener (listener);
buttons.add (button);
panel.add (button);
ImageIcon icon = ImageTools.getIcon ("icons/" + iconFile);
icons.put (button, icon);
return button;
}
// <option value="tpc">Pie Chart (by Class)</option>
// <option value="tstats">Monster Stats</option>
public Component getComponent()
{
return panel;
}
private class IconUpdater implements ActionListener
{
public void actionPerformed (final ActionEvent e)
{
for (AbstractButton button : buttons.getButtons())
button.setIcon (null);
AbstractButton button = (AbstractButton) e.getSource();
if (button.isSelected())
button.setIcon (icons.get (button));
}
}
public static void main (final String[] args)
{
ComponentTools.setDefaults();
ReportSelector rs = new ReportSelector (null);
ComponentTools.open (rs.getComponent(), "ReportSelector");
}
}
|
package textExcel;
public class TextCell extends RootCell {
@Override
public String abbreviatedCellText() {
// print it without the quotes
return Spreadsheet.truncateOrPad(fullCellText().substring(1, fullCellText().length()-1));
}
/**
* @param value
*/
// value should begin and end with double quotes (")
public TextCell(String value) {
super(value);
}
@Override
public String cellType() {
return "TextCell";
}
@Override
public int compareTo(Object o) {
if (o instanceof TextCell) {
TextCell cell = (TextCell)o;
return fullCellText().compareTo(cell.fullCellText());
} else if (o instanceof EmptyCell) {
return 1;
} else if (o instanceof RealCell) {
return -1;
} else {
return -1;
}
}
}
|
package com.gsccs.sme.plat.svg.model;
import com.gsccs.sme.api.domain.corp.Corp;
/**
* 企业对象
* @author x.d zhang
*
*/
public class CorpT extends Corp{
} |
package net.dark.entreprise.international.adhess.savedata.DataBase;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import java.util.Date;
/**
* Created by adhess on 31/05/2018.
*/
public class ModificationDAO extends DAOBase {
public static final String key = "id";
public static final String url = "url";
public static final String last_modificationod = "last_modification";
public static final String table_name = "Modification";
public static final String table_create = "CREATE TABLE " + table_name + " (" +
key + " INTEGER PRIMARY KEY AUTOINCREMENT, " + url + " TEXT," +
last_modificationod + " TEXT );";
public static final String table_drop = "DROP TABLE IF EXISTS " + table_name + ";";
public SQLiteDatabase db;
public ModificationDAO(Context pContext) {
super(pContext);
db = super.open();
}
public void add(Modification m) {
ContentValues value = new ContentValues();
value.put(last_modificationod, m.getLast_modification());
value.put(url, m.getUrl());
mDb.insert(table_name,null,value);
}
public void delete(long id) {
mDb.delete(table_name, key + " = ?", new String[]{String.valueOf(id)});
}
public void modify(int id) {
ContentValues value = new ContentValues();
value.put(last_modificationod, new Date().getTime());
mDb.update(table_name, value, key + " = ?", new String[]{String.valueOf(id)});
}
public Cursor selectALL(){
return mDb.query(false,table_name,null,null,null,
null,null,null,null);
}
public void deleteAll() {
mDb.execSQL(table_drop);
mDb.execSQL(table_create);
}
}
|
package kr.or.ddit.projectsupport.service;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import kr.or.ddit.projectsupport.dao.IProjectSupportDao;
import kr.or.ddit.vo.JoinVO;
import kr.or.ddit.vo.ProjectVO;
import kr.or.ddit.vo.SuccessBoardCommentVO;
import kr.or.ddit.vo.SuccessBoardVO;
public interface IProjectSupportService {
public String sendMail(String to, String title, String content) throws Exception;
public String sms(String to, String text) throws Exception;
public int generateRandNum(int length) throws Exception;
} |
package it.polito.tdp.artsmia.model;
import java.util.ArrayList;
public class TestModel {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Model m = new Model();
Artisti a=new Artisti(1, "giambiero");
Artisti b=new Artisti(1, null);
ArrayList<Artisti>ar=new ArrayList<Artisti>();
ArrayList<Artisti>ab=new ArrayList<Artisti>();
ab.add(b);
ar.add(a);
ar.removeAll(ab);
System.out.println(ar);
}
}
|
package com.asm.entities.worker.salaries;
public enum SalaryIteration {
Diario,
Semanal,
Quincenal,
Mensual,
Sin_Establecer
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package JDBC;
/**
*
* @author Utilisateur
*/
public class CustomerEntity {
// TODO : ajouter les autres propriétés
private int customerId;
private String name;
private String email;
private String city;
private String state;
private String phone;
private String fax;
public CustomerEntity(int customerId, String name, String email) {
this.customerId = customerId;
this.name = name;
this.email = email;
}
public CustomerEntity(int customerId, String name, String email, String city, String state, String phone, String fax){
this.customerId = customerId;
this.name = name;
this.email = email;
this.city=city;
this.fax=fax;
this.phone=phone;
this.state=state;
}
/**
* Get the value of customerId
*
* @return the value of customerId
*/
public int getCustomerId() {
return customerId;
}
/**
* Get the value of name
*
* @return the value of name
*/
public String getName() {
return name;
}
/**
* Get the value of addressLine1
*
* @return the value of addressLine1
*/
public String getEmail() {
return email;
}
public String getCity(){
return city;
}
public String getFax(){
return fax;
}
public String getPhone(){
return phone;
}
public String getState(){
return state;
}
} |
package org.levelup.web.configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer;
import org.springframework.stereotype.Component;
@Component
public class RestConfiguration implements RepositoryRestConfigurer {
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
config.setBasePath("/api/repository"); // адрес в адресной строке, по которому будут доступны репозитории
}
}
|
package baraja;
import java.util.ArrayList;
public class Mano {
ArrayList<Carta> man= new ArrayList<Carta>();
int pos =0;
public void agregarCart(Carta cta){
man.add(cta);
}
public String valorMano(){
String mano="";
for(int i=0; i<man.size(); i++){
mano+=man.get(i).toString() + " ";
}
return mano;
}
public int puntaje(){
int val=0;
boolean ace=false;
for (int i=0; i< man.size(); i++){
Carta tmpCta= man.get(i);
int valorCta= tmpCta.valor();
if(valorCta==1) ace =true;
if(valorCta>10) valorCta=10;
val += valorCta;
}
if(ace== true && val+10<=21) val = val+10;
return val;
}
}
|
package tp2;
import jdk.jshell.spi.ExecutionControl;
import java.util.Arrays;
import java.util.Random;
public class Population {
private Individual[] individuals;
private int genesPerPop;
private Crosstype crosstype;
private float mutationChance;
/**
* Representation of a population of pseudo-randomly generated individuals
* @param popSize set the size of this population
* @param genesPerPop sets the gene size of each individual in the pool
* @param crosstype the crosstype to be used by this population
* @param mutationChance chance for an individual to mutate at birth
*/
public Population(int popSize, int genesPerPop, Crosstype crosstype, float mutationChance)
{
this.individuals = new Individual[popSize];
this.genesPerPop = genesPerPop;
this.crosstype = crosstype;
this.mutationChance = mutationChance;
for(int i=0; i<popSize; i++)
this.individuals[i] = new Individual(genesPerPop);
}
/**
* Representation of a population of pre-computed individuals
* @param individuals an array of individuals
* @param crosstype the crosstype to be used by this population
* @param mutationChance chance for an individual to mutate at birth
*/
public Population(Individual[] individuals, Crosstype crosstype, float mutationChance)
{
assert individuals.length > 0;
this.individuals = individuals;
this.genesPerPop = individuals[0].getGenes().length;
this.crosstype = crosstype;
this.mutationChance = mutationChance;
}
/**
* Creates a new population using this generation's individuals
* @return the newly generated population
*/
public Population generateNewPopulation()
{
Population popu = this;
Individual[] newIndvidials = new Individual[this.individuals.length];
//Utilisez les CROSSTYPE ici pour différencier le type de sélection
if(this.crosstype == Crosstype.ROULETTE){
int counter = 0;
while(counter < this.individuals.length){
//System.out.println("générate population "+counter);
Individual ind1 = roulette();
Individual ind2 = roulette();
//Croissement pour avoir les enfants
Random rand = new Random();
int aléatoire = rand.nextInt(3);
Individual[] kids= new Individual[2];
kids = reproduceIndividuals(ind1,ind2,aléatoire);
if(counter < this.individuals.length){
newIndvidials[counter] = ind1;
//System.out.println("");
counter++;
}
if(counter < this.individuals.length-1){
newIndvidials[counter] = kids[0];
counter++;
}
if(counter < this.individuals.length-2){
newIndvidials[counter] = ind2;
counter++;
}
if(counter < this.individuals.length-3){
newIndvidials[counter] = kids[1];
counter++;
}
}
popu = new Population(newIndvidials,Crosstype.ROULETTE,this.mutationChance);
}
else{ // Tournoi
int counter = 0;
while(counter < this.individuals.length){
//System.out.println("générate population "+counter);
Individual ind1 = tournoi(counter);
Individual ind2 = tournoi(counter);
//Croissement pour avoir les enfants
Random rand = new Random();
int aléatoire = rand.nextInt(3);
Individual[] kids= new Individual[2];
kids = reproduceIndividuals(ind1,ind2,aléatoire);
if(counter < this.individuals.length){
newIndvidials[counter] = ind1;
//System.out.println("");
counter++;
}
if(counter < this.individuals.length-1){
newIndvidials[counter] = kids[0];
counter++;
}
if(counter < this.individuals.length-2){
newIndvidials[counter] = ind2;
counter++;
}
if(counter < this.individuals.length-3){
newIndvidials[counter] = kids[1];
counter++;
}
}
popu = new Population(newIndvidials,Crosstype.TOURNOI,this.mutationChance);
}
//compute fitness
for (int i = 0; i < this.individuals.length-1; i++) {
this.individuals[i].computeFitnessScore();
}
System.out.println("outpute : "+popu.toString());
return popu;
}
private Individual roulette(){
Random rand = new Random();
int aléatoire = rand.nextInt(this.individuals.length);
int cumul =0;
int index =0;
int value = cumul + this.individuals[index].getFitnessScore();
// System.out.println("aléatoire "+aléatoire);
while(cumul + this.individuals[index].getFitnessScore() < aléatoire){
cumul += this.individuals[index].getFitnessScore();
cumul++; //ou on augmente la fitness de tous les individus de 1 sinon on rentre dans une condition infinie jusqu'a dépasser l'index max
index++;
}
return this.individuals[index];
}
/**
*
* @param position le ième individu à selectionner
* @return Individual
*/
private Individual tournoi(int position){
Individual result;
if(this.individuals.length - position <2){
melangePopulation(50);
position = 0;
}
Individual ind1 = this.individuals[position];
Individual ind2 = this.individuals[position+1];
if(ind1.getFitnessScore() > ind2.getFitnessScore()){
result = ind1;
}else{
result = ind2;
}
return result;
}
/**
* Permet de mélanger la population
* @param nb_Mélange le nombre de mélange à effectuer
*/
private void melangePopulation(int nb_Mélange){
Random rand =new Random();
for (int i = 0; i < nb_Mélange; i++) {
int index1 = rand.nextInt(this.individuals.length-1);
int index2 = rand.nextInt(this.individuals.length-1);
Individual temp = this.individuals[index1];
this.individuals[index1] = this.individuals[index2];
this.individuals[index2] = temp;
}
}
/**
* Takes 2 individuals and create 2 children using their genes
* @param firstParent the first selected individual
* @param secondParent the second selected individual
* @param crosspoint index of the crosspoint
* @return an array of 2 individuals
*/
public Individual[] reproduceIndividuals(Individual firstParent, Individual secondParent, int crosspoint)
{
Individual[] offsprings = new Individual[2];
Random rand = new Random();
// System.out.println("xP : "+xP);
int[] kid1 = new int[firstParent.getGenes().length];
int[] kid2 = new int[secondParent.getGenes().length];
//System.out.println("xP : "+xP);
for (int i = 0; i < crosspoint; i++) {
kid1[i] = firstParent.getGenes()[i];
kid2[i] = secondParent.getGenes()[i];
}
for (int i = crosspoint; i < firstParent.getGenes().length; i++) {
kid1[i] = secondParent.getGenes()[i];
kid2[i] = firstParent.getGenes()[i];
}
offsprings[0] = new Individual(kid1);
offsprings[1] = new Individual(kid2);
//La mutation génétique éventuelle : ici 0.05 donc 5%
for (int i = 0; i < 2; i++) {
for (int j = 0; j < offsprings[i].getGenes().length; j++) {
float mutation = rand.nextInt(99)+1;
if(mutation<this.mutationChance*100){
offsprings[i].geneFlip(j);
}
}
}
return offsprings;
}
public int testPopulation(){
int result = 0;
for (int i = 0; i < this.individuals.length; i++) {
if(result < this.individuals[i].getFitnessScore()){
result = this.individuals[i].getFitnessScore();
//System.out.println("score : "+result);
}
}
return result;
}
@Override
public String toString()
{
return "Population{" +
"individuals=" + Arrays.toString(individuals) +
", genesPerPop=" + genesPerPop +
'}';
}
}
|
package swea_d1;
import java.util.Scanner;
public class Solution_2050 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
for(int i = 0 ; i<s.length(); i++) {
System.out.print((int)s.charAt(i)-64+" ");
}
}
}
|
package com.xianzaishi.wms.tmscore.vo;
import java.io.Serializable;
import java.util.Date;
import com.xianzaishi.wms.common.vo.BaseVO;
public class PickBasketVO extends BaseVO implements Serializable {
private Long pickId = null;
private Long agencyId = null;
private Long basketId = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPickId() {
return pickId;
}
public void setPickId(Long pickId) {
this.pickId = pickId;
}
public Long getAgencyId() {
return agencyId;
}
public void setAgencyId(Long agencyId) {
this.agencyId = agencyId;
}
public Long getBasketId() {
return basketId;
}
public void setBasketId(Long basketId) {
this.basketId = basketId;
}
} |
package pages;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
public class SurveyorVisitUpdate extends AbstractPage {
public SurveyorVisitUpdate(){
// This is to load all the elements in the page
PageFactory.initElements(getEventDriver(), this);
}
@FindBy(how=How.XPATH,using="(//a[text()='Claim Request No.']/following::u)[1]")
private WebElement eleGridSurVisitfirstvalue;
public SurveyorVisitUpdate clickGridSurVisitUpdatefirstvalue() {
//click(eleGridEdit);
pause(5);
mouseOverOnElement(eleGridSurVisitfirstvalue);
/*JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("arguments[0].click();",eleGridEdit); */
return this;
}
@FindBy(how=How.XPATH,using="//u[text()=' Visit Update ']")
private WebElement eleSurVisitUpdateVisitPaginationRight;
public SurveyorVisitUpdate clickSurVisitUpdateVisit() {
pause(5);
mouseOverOnElement(eleSurVisitUpdateVisitPaginationRight);
/*JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("arguments[0].click();",eleGridEdit); */
return this;
}
@FindBy(how=How.XPATH,using="//button[@title='Click here to view filter...!']")
public WebElement eleSurVisitUpdateointVisitFilter;
public SurveyorVisitUpdate clickSurVisitUpdateointVisitFilter() {
pause(4);
click(eleSurVisitUpdateointVisitFilter);
return this;
}
@FindBy(how=How.XPATH,using="//input[@id='SelectedJobCode']")
public WebElement eleSurveyor_JobFilter;
public SurveyorVisitUpdate clickSurveyor_AppointmentJobFilter() {
pause(4);
click(eleSurveyor_JobFilter);
return this;
}
@FindBy(how=How.XPATH,using="//input[@id='Selectedclaimno']")
public WebElement eleSurVisitUpdateVisitFilter;
public SurveyorVisitUpdate clickSurVisitUpdateVisitFilter() {
pause(4);
click(eleSurVisitUpdateVisitFilter);
return this;
}
@FindBy(how=How.XPATH,using="//input[@id='SelectedPolicyNo']")
public WebElement eleSurVisitUpdateVisitPolicyNo;
public SurveyorVisitUpdate typeAndEnterSurPolicyNo(String dataSurVisitPolicyNo){
pause(1);
typeAndChoose(eleSurVisitUpdateVisitPolicyNo, dataSurVisitPolicyNo);
return this;
}
@FindBy(how=How.XPATH,using="//button[text()='Get List']")
private WebElement eleSurVisitGetList;
public SurveyorVisitUpdate clickSurVisitGetList() {
click(eleSurVisitGetList);
return this;
}
@FindBy(how=How.XPATH,using="//button[text()='Close']")
private WebElement eleSurVisitClose;
public SurveyorVisitUpdate clickSurVisitClose() {
click(eleSurVisitClose);
return this;
}
@FindBy(how=How.XPATH,using="(//button[text()='×'])[2]")
private WebElement elexCloseSurVisitUpdate;
public SurveyorVisitUpdate clickxCloseSurVisit() {
click(elexCloseSurVisitUpdate);
return this;
}
@FindBy(how=How.XPATH,using="//span[text()='arrow-e']")
private WebElement eleSurVisitUpdatePaginationRight;
public SurveyorVisitUpdate clickSurVisitUpdatePaginationRight() {
click(eleSurVisitUpdatePaginationRight);
return this;
}
@FindBy(how=How.XPATH,using="//span[text()='seek-e']")
private WebElement eleSurVisitUpdatePaginationRightlast;
public SurveyorVisitUpdate clickSurVisitUpdatePaginationRightlast() {
click(eleSurVisitUpdatePaginationRightlast);
return this;
}
@FindBy(how=How.XPATH,using="//span[text()='arrow-w']")
private WebElement eleSurVisitUpdatePaginationLeft;
public SurveyorVisitUpdate clickSurVisitUpdatePaginationLeft() {
click(eleSurVisitUpdatePaginationLeft);
return this;
}
@FindBy(how=How.XPATH,using="//span[text()='seek-w']")
private WebElement eleSurVisitUpdatePaginationLeftlast;
public SurveyorVisitUpdate clickSurVisitUpdatePaginationLeftlast() {
click(eleSurVisitUpdatePaginationLeftlast);
return this;
}
@FindBy(how=How.XPATH,using="(//span[text()='select'])[2]")
public WebElement eleSurPaginationItemPerPage;
public SurveyorVisitUpdate clickSurPaginationItemPerPage(){
pause(2);
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("arguments[0].click();",eleSurPaginationItemPerPage);
return this;
}
public SurveyorVisitUpdate selectUsingTexteleSurVisitUpdateItemperpage(String SurVisitUpdateItemPerPage){
pause(2);
selectUsingText(locateElement("xpath","//li[text()='"+SurVisitUpdateItemPerPage+"']"), SurVisitUpdateItemPerPage);
return this;
}
@FindBy(how=How.XPATH,using="//button[@title='Click here to view filter...!']")
public WebElement eleCreateFilter;
public SurveyorVisitUpdate clickCreateClaimFilter() {
click(eleCreateFilter);
return this;
}
@FindBy(how=How.XPATH,using="//input[@id='Selectedclaimno']")
public WebElement eleEditCreateClaimFilter;
public SurveyorVisitUpdate typeCreateClaim() {
pause(4);
System.out.println(ClaimNum);
typeAndChoose(eleEditCreateClaimFilter,ClaimNum);
return this;
}
@FindBy(how=How.XPATH,using="//button[text()='Get List']")
private WebElement eleEditGetList;
public SurveyorVisitUpdate clickCreateGetList() {
click(eleEditGetList);
return this;
}
@FindBy(how=How.XPATH,using="(//u[text()=' Visit Update '])[1]")
private WebElement eleclickSurveyorVisitUpdateFirstLink;
public SurveyorVisitUpdate clickSurveyorVisitUpdateFirstLink() {
click(eleclickSurveyorVisitUpdateFirstLink);
return this;
}
@FindBy(how=How.XPATH,using="//input[@id='strVisitedDate']")
private WebElement eletypeSurveyorVisitDate;
public SurveyorVisitUpdate clickandSelectSurveyorVisitDate(String monthVistiDate,String yearVistiDate) {
click(eletypeSurveyorVisitDate);
selectDate4(eletypeSurveyorVisitDate, "Visited Date", monthVistiDate, yearVistiDate, "25");
return this;
}
@FindBy(how=How.XPATH,using="//input[@id='strRevisionEstimation']")
private WebElement eletypeSurveyorRevisionAmt;
public SurveyorVisitUpdate typeSurveyorRevisionAmt(String surRevisedAmt) {
type(eletypeSurveyorRevisionAmt,surRevisedAmt);
return this;
}
@FindBy(how=How.XPATH,using="//textarea[@id='strRevisionEstimationRemarks']")
private WebElement eletypeSurveyorRemarks;
public SurveyorVisitUpdate typeSurveyorRemarks(String surRemarks) {
type(eletypeSurveyorRemarks,surRemarks);
return this;
}
@FindBy(how=How.XPATH,using="//button[text()='Submit']")
private WebElement eleclickSurveyorVisitSubmit;
public SurveyorVisitUpdate clickSurveyorVisitSubmit() {
click(eleclickSurveyorVisitSubmit);
return this;
}
@FindBy(how=How.XPATH,using="//div[@class='bootbox-body']/div")
private WebElement eledialogMsg;
public SurveyorVisitUpdate getdialogMsg()
{
pause(5);
//dialogMessage = getText(eledialogMsg);
System.out.println("Dialog message:"+ getText(eledialogMsg));
reportStep("The element"+ eledialogMsg +"is not visible", "WARNING");
return this;
}
@FindBy(how=How.XPATH,using="(//button[text()='OK'])[2] ")
private WebElement eledialogMsgClose;
public SurveyorVisitUpdate closeDialogMsg()
{
click(eledialogMsgClose);
return this;
}
}
|
package p0300;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
public class P0315CP extends JPanel
{
private Color foreColor;
public P0315CP()
{
changeColor();
}
public void changeColor()
{
Random r = new Random();
foreColor = new Color(r.nextInt());
repaint();
}
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
g.setColor(foreColor);
g.fillOval(0, 0, getWidth(), getHeight());
}
}
|
package com.minhvu.proandroid.sqlite.database.main.view.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Process;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import com.minhvu.proandroid.sqlite.database.R;
import com.minhvu.proandroid.sqlite.database.main.model.GetShareModel;
import com.minhvu.proandroid.sqlite.database.main.model.view.IGetShareModel;
import com.minhvu.proandroid.sqlite.database.main.presenter.GetSharePresenter;
import com.minhvu.proandroid.sqlite.database.main.presenter.view.IGetSharePresenter;
import com.minhvu.proandroid.sqlite.database.main.view.Activity.view.IGetShareActivity;
/**
* Created by vomin on 9/11/2017.
*/
public class GetShareActivity extends AppCompatActivity implements View.OnClickListener, IGetShareActivity.View{
TextView tvImageCount;
EditText etTitle;
EditText etContent;
ImageButton btnSave;
Button btnDetail;
Button btnRemoveTitle;
private IGetSharePresenter presenter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.get_share_activity);
Toolbar toolbar = new Toolbar(this);
setSupportActionBar(toolbar);
setupView();
setup();
Intent intent = getIntent();
if(intent.hasExtra(Intent.EXTRA_TEXT)){
String stringShares = intent.getStringExtra(Intent.EXTRA_TEXT);
processText(stringShares);
}
if(intent.getData() != null){
Uri noteUri = intent.getData();
loadNote(noteUri);
}
if(intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT) != null){
String processText = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
processText = intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT).toString();
processText(processText);
}
}
}
void setupView(){
tvImageCount = (TextView) findViewById(R.id.tvImageCount);
etTitle = (EditText) findViewById(R.id.etTitle);
etContent = (EditText) findViewById(R.id.etContent);
btnSave = (ImageButton) findViewById(R.id.btnInsert);
btnSave.setOnClickListener(this);
btnRemoveTitle = (Button) findViewById(R.id.btnRemoveTitle);
btnDetail = (Button) findViewById(R.id.btnDetail);
btnDetail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
presenter.onDetailOnClick();
}
});
btnRemoveTitle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
etTitle.requestFocus();
etTitle.setText("");
}
});
invisibleView();
}
void setup(){
IGetShareModel model = new GetShareModel(this);
presenter = new GetSharePresenter();
presenter.bindView(this);
presenter.setModel(model);
model.setPresenter(presenter);
}
@Override
public void onClick(View v) {
presenter.saveNote(etTitle, etContent);
finish();
}
private void processText(String stringsShare){
if(stringsShare == null){
return;
}
etTitle.setText(stringsShare);
etContent.setText(stringsShare);
}
private void handleShare(String[] stringsShare){
if(stringsShare == null){
return;
}
if(stringsShare.length == 1){
etTitle.setText(stringsShare[0]);
etContent.setText(stringsShare[0]);
}
if(stringsShare.length == 2){
etTitle.setText(stringsShare[0]);
etContent.setText(stringsShare[1]);
}
}
private void loadNote(Uri uri){
if(uri == null){
return;
}
presenter.setCurrentUri(uri);
presenter.loadNote();
}
@Override
public Context getActivityContext() {
return this;
}
@Override
public Context getAppContext() {
return getAppContext();
}
@Override
public void visibleView() {
tvImageCount.setVisibility(View.VISIBLE);
btnDetail.setVisibility(View.VISIBLE);
}
@Override
public void invisibleView() {
tvImageCount.setVisibility(View.GONE);
btnDetail.setVisibility(View.GONE);
}
@Override
public void updateView(String title, String content) {
etTitle.setText(title);
etContent.setText(content);
}
@Override
public void finishThis() {
finish();
}
@Override
public void showToast(Toast toast) {
toast.show();
}
@Override
public void showDialog(Dialog dialog) {
dialog.show();
}
@Override
public void updateImageCount(int count) {
String data = count + " Images";
tvImageCount.setText(data);
}
@Override
public void lockContent() {
etContent.setFocusable(false);
btnSave.setVisibility(View.GONE);
}
@Override
protected void onDestroy() {
super.onDestroy();
presenter.onDestroy(isChangingConfigurations());
presenter = null;
Process.killProcess(Process.myPid());
}
@Override
protected void onPause() {
super.onPause();
presenter.onDestroy(isChangingConfigurations());
Process.killProcess(Process.myPid());
}
@Override
public void onBackPressed() {
finish();
}
}
|
package by.orion.onlinertasks.data.models.credentials;
import com.google.auto.value.AutoValue;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
@AutoValue
public abstract class Credentials {
@SerializedName("access_token")
public abstract String accessToken();
@SerializedName("expires_in")
public abstract Date expiresIn();
@SerializedName("token_type")
public abstract String tokenType();
@SerializedName("refresh_token")
public abstract String refreshToken();
public static Builder builder() {
return new AutoValue_Credentials.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder accessToken(String accessToken);
public abstract Builder expiresIn(Date expiresIn);
public abstract Builder tokenType(String tokenType);
public abstract Builder refreshToken(String refreshToken);
public abstract Credentials build();
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.