text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public AuthorModel addAuthor(AuthorModel author) throws WebshopAppException {
int generatedId = AuthorModel.DEFAULT_ID;
if (isValidAuthor(author, "ADD_AUTHOR")) {
try (Connection conn = getConnection()) {
String sql = "INSERT INTO author (firstname, lastname, dob, country)"
+ "VALUES (?, ?,... | 3 |
@SuppressWarnings("rawtypes")
public String getUsoDestinoMasArea() {
// Si hay destinos cogemos el de mayor area
if (destinos != null && !destinos.isEmpty()) {
String destino = "";
double area = 0;
Iterator<Entry<String, Double>> it = destinos.entrySet().iterator();
// Comparamos las areas de los de... | 8 |
public boolean estaEmS(String transacao) {
boolean res = false;
for (String s : lockS) {
if (s.equals(transacao)) {
res = true;
}
}
return res;
} | 2 |
public static void createTrees(ResearchScreen rs) {
Collection<ResearchItem> items = Application.get().getLogic().getGame().getResearch().getRoots();
int indx = 0;
for(ResearchItem ri : items) {
createTree(rs, ri, 100+indx*180, 100);
indx++;
}
} | 1 |
public static void commandMute(CommandSender sender, String player, String duration){
if (player == null || duration == null) {
sender.sendMessage(Msg.$("mute-usage"));
return;
}
int mute;
try {
mute = Integer.parseInt(dura... | 7 |
private Boolean isPresent(String FileOrDirectoryName, Boolean includeProxy)
{
for(DistributedFile f: files)
if(f.getFileName().equals(FileOrDirectoryName) )
return true;
for(Directory d: childDirectories)
if(d.getName().equals(FileOrDirectoryName))
return true;
if(includeProxy)
for(String s:... | 7 |
@Override
public void add(CreditProgram element) {
//Добавляем запись в список
getList().add(element);
Statement statement = null;
ResultSet result = null;
try {
//Создаем изменяемую выборку
statement = getConnection().createStatement(ResultSet.TYPE_S... | 2 |
public static boolean dragDraggable(final Draggable d, final int slot) {
return d != null
&& (SlotData.getDraggableId(slot) == d.getId() || d.show() && dragChild(d.getChild(), slot)
&& new TimedCondition(700) {
@Override
public boolean isDone() {
return d.getId() == SlotData.getDragga... | 4 |
private final void method735(AbstractToolkit var_ha, Class72 class72_19_) {
method738(var_ha);
method732(var_ha);
var_ha.getDimensions(anIntArray1226);
var_ha.setDimensions(0, 0, anInt1220, anInt1220);
var_ha.ya();
var_ha.drawQuad(0, 0, anInt1220, anInt1220, ~0xffffff | anInt1222, 0);
int i = 0;
int i_20_ = 0;
... | 5 |
public boolean validarContato(Contato contato){
List<Contato> listaContatos = fachada.FachadaSistema.getInstance().listarContatos();
for (Contato contatoBusca : listaContatos) {
if(contatoBusca.getNome().equals(contato.getNome())){
JOptionPane.showMessageDialog(null, "... | 9 |
public SampleBuffer(int sample_frequency, int number_of_channels)
{
buffer = new short[OBUFFERSIZE];
bufferp = new int[MAXCHANNELS];
channels = number_of_channels;
frequency = sample_frequency;
for (int i = 0; i < number_of_channels; ++i)
bufferp[i] = (short)i;
} | 1 |
public Msg read()
{
if (!in_active || (state != State.active && state != State.pending))
return null;
Msg msg_ = inpipe.read ();
if (msg_ == null) {
in_active = false;
return null;
}
// If delimiter was read, start termination process o... | 8 |
public String readCStr() throws IOException {
boolean isAscii = true;
// short circuit 1 byte strings
_random[0] = read();
if (_random[0] == 0) {
return "";
}
_random[1] = read();
if (_random[1] == 0) {
... | 8 |
public static void main(String[] args) {
Scanner cal = new Scanner(System.in);
System.out.println("Enter number of units for calculating the bill : \n");
double Bill = cal.nextDouble();
double B = 1;
if (Bill < 100) {
System.out.println("Calculated Bill is : $ " + B);
} else if (Bill > 100 || B... | 6 |
public static <Z> Aggregator<Z> createAggregator(Class<?> returnType) throws AggregationException {
if (returnType.equals(Integer.TYPE) || returnType.equals(Integer.class)) {
return (Sum<Z>) new IntegerSum();
} else if (returnType.equals(Double.TYPE) || returnType.equals(Double.class)) {
... | 8 |
public void setGridletStatus(int newStatus) throws Exception
{
// if the new status is same as current one, then ignore the rest
if (status_ == newStatus) {
return;
}
// throws an exception if the new status is outside the range
if (newStatus < Gridlet.CREATED ||... | 5 |
@Override
public void initialize(JSONObject dataMixinValue) throws JSONException,
DataFormatException {
JSONArray dataMixinArray = dataMixinValue.getJSONArray("mixins");
this.regularTileMixins = new RegularTileMixin[dataMixinArray.length()];
this.firstEventMixins = new FirstEventMixin[dataMixinArray.length()]... | 7 |
private MemoryNode encontrarHojaDondeEstaQ(MemoryNode node, double[] q) throws IOException {
comparaciones++;
node.setVisitado(1);
if (node.getLeft() == null || node.getRight() == null) {
double distNueva = Math
.sqrt((Math.pow((q[0] - node.getX()), 2) + Math.pow(
(q[1] - node.getY()), 2)));
dis... | 6 |
public double getStrength(ArrayList<Card> holeCards) throws Exception {
if (holeCards.size() != 2) {
throw new Exception("Not correct amount of hole cards");
}
if (holeCards.get(0).sign == holeCards.get(1).sign) { // suited
// in cause of a triangular matrix you have to look on the right sight
if (holeCa... | 4 |
public static void main(String[] args) {
BLPSystem sys = new BLPSystem();
SecurityLevel low = SecurityLevel.low;
SecurityLevel high = SecurityLevel.high;
// We add two subjects, one high and one low.
sys.createSubject("Lyle", low);
sys.createSubject("Hal", high);
... | 3 |
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... | 8 |
private String useElementVariables(String s) {
if (!(model instanceof AtomicModel))
return s;
int lb = s.indexOf("%element[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
while (lb != -1 && rb != -1) {
v = s.substring(lb + 9, rb);
double x = parseMathExpression(v);
if (Double.... | 7 |
Point3i adjustedTemporaryScreenPoint() {
float z = (point3fScreenTemp.z - perspectiveOffset.z);
if (z < cameraDistance) {
if (Float.isNaN(point3fScreenTemp.z)) {
// removed for extending pmesh to points and lines BH 2/25/06
if (!haveNotifiedNaN)
Logger.debug("NaN seen in TransformPoint");
haveNo... | 7 |
static public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextCol... | 6 |
public static void addSuccessMessage(String msg) {
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg);
} | 0 |
public String login(String vCloudUrl, String username, String orgName, String password) throws Exception
{
String loginString = Utils.CLOUD_URL_PREFIX + vCloudUrl + Utils.CLOUD_URL_SUFFIX;
String creds;
if(username.contains("@")) {
creds = username +":" + password;
} else {
creds = username + "@" + orgN... | 2 |
public static void renderBlank(Graphics2D g, boolean blue) {
try {
SVGDiagram diagram = universe.getDiagram(ImageManager.class.getResource(urlBase + (blue ? "blue.svg" : "red.svg")).toURI());
diagram.setIgnoringClipHeuristic(true);
diagram.render(g);
} catch (URISynt... | 3 |
public static void main(String[] args) {
String path = System.getProperty("user.dir") + FILE_PATH;
Dictionary dictionary = new Dictionary(path);
System.out.println("initializing dictionary...");
dictionary.preprocess();
Scanner userInputScanner = new Scanner(System.in);
S... | 3 |
public Piirtaja(Pelaaja pelaaja, Kamera kamera) {
this.pelaaja = pelaaja;
this.kamera = kamera;
} | 0 |
public VariableStack mapStackToLocal(VariableStack stack) {
StructuredBlock[] subBlocks = getSubBlocks();
VariableStack after;
if (subBlocks.length == 0)
after = stack;
else {
after = null;
for (int i = 0; i < subBlocks.length; i++) {
after = VariableStack.merge(after,
subBlocks[i].mapStackTo... | 3 |
public static Book parseBook(String data) throws IOException {
Book book = new Book();
try {
String tokens[] = data.split("[=]|[\\{]|[\\}]|[,]");
if(data.indexOf("Book") != -1 || tokens.length > 0) {
for( int i = 0; i < tokens.length ; i++) {
... | 8 |
public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
MethodVisitor mv;
if ("<clinit>".equals(name)) {
int a = Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC;
String n = prefix + counter++;
mv = cv.visitMethod(a, n, desc, ... | 2 |
public void buildClassifier(Instances data) throws Exception{
//heuristic to avoid cross-validating the number of LogitBoost iterations
//at every node: build standalone logistic model and take its optimum number
//of iteration everywhere in the tree.
if (m_fastRegression && (m_fixedNumIterations < 0)) m_fixedNum... | 8 |
private static boolean addToZip(String absolutePath, String relativePath, String fileName, ZipOutputStream out) {
File file = new File(absolutePath + File.separator + fileName);
DebugUtils.info("Adding \"" + absolutePath + File.separator + fileName + "\" file");
if (file.isHidden())
return true;
if... | 6 |
public static List<List<ICard>> getPrese(ICard card, List<ICard> tableCards){
List<List<ICard>> retPrese = new ArrayList<List<ICard>>();
//singola presa
for(ICard c : tableCards)
if(card.getNumber() == c.getNumber())
{
ArrayList<ICard> spresa = new ArrayList<ICard>();
spresa.add(c);
spresa.ad... | 5 |
public static void main(String [] args) throws SocketException, NoSuchAlgorithmException {
if(args.length < 2) {
System.out.println("Invalid number of arguments to start server. Needs <port> <shared secret>");
return;
}
try {
UDPServer server = new UDPServer(I... | 4 |
protected void saveBest() {
try {
if (runBestIndividual == null)
throw new IOException("No run best individual");
List<Individual> bestIndividuals = new ArrayList<Individual>();
File inputFolder = new File("results/input");
File outputFolder = new File("results/output");
if (!input... | 7 |
public void actionPerformed(ActionEvent e) {
if (e.getSource() == kilobutton) {
kilotext.setEnabled(true);
kbytes.enable();
}
else {
kilotext.setEnabled(false);
kbytes.disable();
}
if (e.getSource() == megabutton) {
megatext.setEnabled(true);
mbytes.enable();
}
else {
megatext.setE... | 3 |
public static JPanel makePanel(int orientation) {
JPanel p = new JPanel();
switch (orientation) {
case HORIZONTAL:
p.setLayout(new GridLayout(1, 0));
break;
case VERTICAL:
p.setLayout(new GridLayout(0, 1));
break;
default:
break;
}
return p;
} | 2 |
private static int method503(char ac[], char ac1[], int j)
{
if(j == 0)
return 2;
for(int k = j - 1; k >= 0; k--)
{
if(!method517(ac[k]))
break;
if(ac[k] == '@')
return 3;
}
int l = 0;
for(int i1 = j - 1; i1 >= 0; i1--)
{
if(!method517(ac1[i1]))
break;
if(ac1[i1] == '*')
l... | 9 |
public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)... | 6 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Category other = (Category) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id)... | 8 |
private void loadCoffers(){
File cofferFile = new File(getDataFolder(),cofferFileName);
if(!cofferFile.exists()){
logMessage("Coffer file does not exist");
return;
}
FileConfiguration config = YamlConfiguration.loadConfiguration(cofferFile);
Iterator<String> citr = config.getConfigurationSection("c... | 6 |
private void logOutput() throws VehicleException, SimulationException, IOException {
// reset text area
logText.setText("");
Log log = new Log();
// update log
if(valid()){
log.initialEntry(cp, s);
for (int time=0; time<=Constants.CLOSING_TIME; time++) {
//queue elements exceed max waiti... | 6 |
public ArrayList<String> readTestData() throws IOException{
ArrayList<String> candAttr = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = "";
while (!(str = reader.readLine()).equals("")) {
StringTokenizer tok... | 2 |
private long consumeCurrentToken()
throws IOException {
if( this.currentToken == null )
return -1L;
byte[] buff = new byte[256];
int len;
long totalLength = 0;
if( !this.currentToken.isClosed() ) {
while( (len = this.currentToken.read(buff)) > 0 )
totalLength += len;
}
this.currentToken.clos... | 3 |
private static void filterMapper(String realJvmCostDir, String mapperJvmCost,
String filteredMapper) {
File input = new File(realJvmCostDir + mapperJvmCost);
File output = new File(realJvmCostDir + filteredMapper);
if(!output.exists())
output.getParentFile().mkdirs();
try {
BufferedReader reader ... | 6 |
public Validator<T> getValidatorRHS() {
return validatorRHS;
} | 0 |
public boolean setParallelJobProbabilities(int jobType,
double uLow, double uMed, double uHi, double uProb) {
if(jobType > BATCH_JOBS || jobType < INTERACTIVE_JOBS) {
return false;
} else if (uLow > uHi) {
return false;
} else if (uMed > uHi-1.5 || uMed < uHi-3.5) {
return false;... | 8 |
private StructureFile readRoot(Node root) throws SyntaxException {
StructureFile structure = new StructureFile();
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child instanceof Element)
readChunkDec(structure, (Element) chil... | 2 |
void vouting(Object obj, final String userid) {
vote.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Map<String, Object> m = new HashMap<String, Object>();
m.put("action", "vote");
m.put("userfrom",View._model.user_id );
m.put("userto", userid )... | 0 |
public Habitat getHabitatByTenant(String tenant) {
for (Habitat h : getHabitats().values()) {
if (h != null)
if (h.getTenant().equalsIgnoreCase(tenant)) return h;
}
return null;
} | 3 |
public long uniquePathsWithObstacles(int[][] obstacleGrid) {
int m = obstacleGrid.length;
int n = obstacleGrid[0].length;
if(m<1||n<1) return 0;
if(m==1 && n==1) return obstacleGrid[0][0]^1;
long count[][] = new long[m+1][n+1];
for(int i=0;i<=m;i++) count[i][0] = 0;
for(int i=0;i<=n;i++) count[0][i] = 0;
... | 9 |
public boolean twoOpt555(){
int pathLength=tour.length();
boolean better=false;
for(int currentVerticeIndex=0; currentVerticeIndex<pathLength;currentVerticeIndex++){
int nextVerticeIndex=(currentVerticeIndex+1)%pathLength;
//skip the current and the nextVerticeIndex
int toVerticeIndex=(currentVerticeI... | 6 |
public void removeWalls(int wallsToRemove){
ArrayList<MazeNode> walls = new ArrayList<MazeNode>();
for(int row = 1; row < this.rows - 1; row++){
for(int column = 1; column < this.columns - 1; column++){
if(getNode(column, row).isWall()){
walls.add(getNode(column, row));
}
}
}
Collections.shuf... | 4 |
private static List<SubFileParser> getCompletedWorkers( File rdpFile, int numCPUs)
throws Exception
{
BlockingQueue<String> blockingQueue = new LinkedBlockingQueue<String>();
List<SubFileParser> subList = new ArrayList<SubFileParser>();
int numAdded = 0;
List<Thread> startedThreads = new ArrayList<Thread>();... | 8 |
public void setPassword(String password) {
this.password = password;
} | 0 |
private void renewASL(){
ASL_model.removeAllElements();
for (int i = 0; i<logAc.getDoctorSize(); i++){
ASL_model.add(i, logAc.getDoctor(i).getName());
}
ASL_adminmodel.removeAllElements();
for (int i = 0; i<logAc.getAdminSize(); i++){
ASL_adminmodel.add(i, logAc.getAdmin(i).getName());
}
ASR_doctor.... | 2 |
void loadTile(String[] split)
{
setExplored(Boolean.valueOf(split[1]));
setTilehealth(Integer.valueOf(split[2]));
if(!split[3].equals("null"))
setDesignate(TaskEnum.valueOf(split[3]));
setActualTask(Integer.valueOf(split[4]));
/*
* TODO: split[5] creat... | 5 |
public Map<String, List<Map<String, String>>> readLocators(List<String> locAppIDs){
Map<String, List<Map<String, String>>> locatorSets= new LinkedHashMap<String, List<Map<String, String>>>();
if(locAppIDs.size()>0){
EnvironmentVariables ev = EnvironmentVariables.getInstance();
for (String appID : locAppIDs) {... | 7 |
public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar(UnrestrictedGrammar.class);
myGrammar=g;
if (g == null)
return;
if (g.getTerminals().length==0)
{
JOptionPane.showMessageDialog(environment,
"Error : This grammar does not accept any Strings. ",
"Cannot Proceed wit... | 3 |
public void analyzeShots(RoomAnalysis ra) {
double closest_shot_distance2 = Double.MAX_VALUE;
for (Shot shot : current_room.getShots()) {
double shot_distance2 = MapUtils.distance2(bound_object, shot);
if (shot.getType().equals(ObjectType.MegaMissile) &&
MapUtils.distance2(bound_object... | 8 |
@Override
public boolean remove(int codigo) {
boolean status = false;
Connection con = null;
PreparedStatement pstm = null;
try{
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(REMOVE);
pstm.setInt(1, codigo);
pstm.... | 3 |
private void graphToPS(File psOutputFile, Rectangle boundingBox, PositionTransformation pt){
EPSOutputPrintStream pw = null;
try {
pw = new EPSOutputPrintStream(psOutputFile);
} catch (FileNotFoundException e) {
Main.minorError("Could not open the file to write the ps to.");
}
pw.setBoundingBox((i... | 8 |
public static void main(String[] args) {
//首先获取一个path
Path path = FileSystems.getDefault().getPath("D:/a.txt");
final ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
//打开一个通道
try(AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(path, StandardOpenOption.READ,
... | 9 |
public Card getNextUntappedPerm(String permName, Player controller) {
for (Card perm : this.permanents) {
if (perm.getName().equals(permName)
&& perm.getController().equals(controller)
&& !perm.isTapped()) {
return perm;
}
}
return null;
} | 4 |
private void populateFilters() {
//Populate gym filter
getGyms().clear();
//get all gyms
Iterable<Entry> gymResultSet = MongoHelper.query("{id:{$gte:0}}", Gym.class, "gyms");
if (gymResultSet != null) {
//Iterate through gyms matching query
for (Entry en... | 9 |
public void drawStateLabel(Graphics g, State state, Point point, Color color) {
String[] labels = state.getLabels();
if (labels.length == 0)
return;
int ascent = g.getFontMetrics().getAscent();
int heights = 0;
int textWidth = 0;
for (int i = 0; i < labels.length; i++) {
Rectangle2D bounds = g.getFo... | 3 |
public String getOptions(Request request) {
try {
return String.join(",", getRoutesMap(request).get(request.getURI()).keySet());
} catch (NullPointerException e) {
return "GET";
}
} | 1 |
@Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... | 3 |
public void menuTextSym() {
int choice;
do {
System.out.println("\n");
System.out.println("Text Cryption Menu");
System.out.println("Select Symmetric Cryption Methode");
System.out.println("---------------------------------\n");
System.out.pri... | 5 |
protected void spawnLettersNEW_OLD(int amount) {
char[] randomCharacters = new char[amount];
char temp;
int generatedVowels;
int bonusVowels;
final int MINIMUM_VOWELS = 6; // (6 for 40%)
bonusVowels = rand.nextInt(((2 - 0) + 1) + 0);
bonusVowels--; // TODO: this is lame, just fix it by fixin... | 9 |
@SuppressWarnings("unchecked")
private T createEntity(T entity) {
try {
return (T) entity.getClass()
.getConstructor(new Class<?>[] { entity.getClass() })
.newInstance(entity);
} catch (IllegalArgumentException e) {
e.printStackTrace()... | 7 |
Object value() {
return (idx == null) ? val : Util.accessArray(name, val, idx);
} | 1 |
public void setFirst(T newValue) { first = newValue; } | 0 |
public void setImgPath_SliderArrowUp(Path img, Imagetype type) {
switch (type) {
case DEFAULT:
this.imgSliderArrowUp_Def = handleImage(img, UIResNumbers.SLIDER_UP_DEF.getNum());
if (this.imgSliderArrowUp_Def == null) {
this.imgSliderArrowUp_Def = U... | 6 |
private void updateRankCap(String Rank, String RankCap, JComboBox rankcapComboBox) {
oldRankCap = RankCap;
rankcapComboBox.setActionCommand("other");
rankcapComboBox.removeItem("12");
rankcapComboBox.removeItem("11");
rankcapComboBox.removeItem("10");
rankcapComboBox.removeItem("9");
rankcapComboBox.re... | 8 |
public void visitFrame(
final int type,
final int nLocal,
final Object[] local,
final int nStack,
final Object[] stack)
{
buf.setLength(0);
switch (type) {
case Opcodes.F_NEW:
case Opcodes.F_FULL:
declareFrameTypes(nLoca... | 7 |
public void transferHeadFiles(BufferedReader consoleInput) throws IOException {
directory.setWorkingDir(ProjectDirectory);
if (HEAD != null) {
for(int i=0; i<HEAD.files.size(); i++) {
String headpath = HeadFilesDirectory + File.separator + HEAD.files.get(i);
String projectpath = ProjectDirectory + File.s... | 7 |
public String getEnding(Number aNumber, Case aCase)
{
//Exception for Dat/Abl/Loc pl for filia/dea
if ( (getStem().equalsIgnoreCase("fili") || getStem().equalsIgnoreCase("de") || getStem().equalsIgnoreCase("lup") ||
getStem().equalsIgnoreCase("equ") || getStem().equalsIgnoreCase("simi")) &&
(aCase == No... | 9 |
public void upkeep(){
for(Creature c : p1.getCritters())
c.setSumSick(false);
} | 1 |
private void check_connection(){
Statement stmt;
ResultSet mysql_result;
try{
//Execute Query
stmt = mysql_connection.createStatement();
mysql_result = stmt.executeQuery("SELECT 1 from DUAL WHERE 1=0");
mysql_result.close();
}
cat... | 5 |
void output( int code, OutputStream outs ) throws IOException
{
cur_accum &= masks[cur_bits];
if ( cur_bits > 0 )
cur_accum |= ( code << cur_bits );
else
cur_accum = code;
cur_bits += n_bits;
while ( cur_bits >= 8 )
... | 8 |
private void btnFinalizarPagaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizarPagaActionPerformed
if(JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0){
try{
Pagamento paga = new Pagamento();
//Setando os... | 3 |
public T getRandomObject(Random rand)
{
if(!list.isEmpty())
{
int r = rand.nextInt(totalWeight);
Iterator<WeightEntry> i = list.iterator();
while(i.hasNext())
{
WeightEntry e = i.next();
if(e.inRange(r))
{
return e.getObject();
}
}
}
return null;
} | 3 |
public static void decodeToFile(String dataToDecode, String filename)
throws java.io.IOException {
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(
new java.io.FileOutputStream(filename), Base64.DECODE);
bos.write(dataToDecode.getBytes(PREFERRED_ENCODING));
} catch (java.io.IOEx... | 2 |
public String toCSV() {
return super.toCSV();
} | 0 |
@Override
public void run() {
//timer
long lastTime;
lastTime = System.nanoTime();
long timer;
timer = System.currentTimeMillis();
final double ns;
ns = 1000000000.0 / 60.0;
double delta;
delta = 0;
//ups & fps counter
int ... | 3 |
public static void main(String args[]) {
/* System.out.println(newLine + "Queue in Java" + newLine);
System.out.println("-----------------------" + newLine);
System.out.println("Adding items to the Queue" + newLine);
//Creating queue would require you to create instannce of LinkedList... | 1 |
public static void performTests(PrintWriter reporter) {
StudentMaster sm = new StudentMaster("Doug");
Student s = new Student("Doug");
for (int i = 0; i < 101; i++) {
s.addExamGrade(79.9);
sm.addExamGrade(79.9);
}
reporter.print(sm.equals(s));
sm = new StudentMaster("Doug");
s = new Student("Doug... | 9 |
public boolean hasWhitelistBypassPermission() {
return this.whitelistByPassPermission != null && !this.whitelistByPassPermission.equals("*") && !this.whitelistByPassPermission.equals("");
} | 2 |
public boolean isSymmetric(TreeNode root) {
if (root == null) return true;
if (root.left == null && root.right == null) return true;
if (root.left == null || root.right == null) return false;
if (root.left.val != root.right.val) return false;
TreeNode node = new TreeNode(0);
node.left = root.... | 8 |
void show(){
} | 0 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
protected LinkedHashMap<Pattern, String> load(File propertyFile) {
LinkedHashMap<Pattern, String> result = new LinkedHashMap<Pattern, String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(propertyFile... | 8 |
public void tfidfFromFile(String queryPath) throws FileNotFoundException{
Scanner sc = new Scanner(new BufferedReader(new FileReader(queryPath)));
String line = sc.nextLine();
// Get Name and Text of document
contents = line.toString().split("\\s+",2);
words = contents[1].split("\\s+");
// Process f... | 9 |
@Override
public Properties getOutputProperties(){
Properties properties = new Properties();
properties.put(NAME,getName());
properties.put(DATE,Utils.toString(date));
properties.put(AMOUNT, amount.toString());
properties.put(COMMUNICATION, communication);
if(counterP... | 2 |
public static /*@pure@*/ int[] stableSort(double[] array){
int[] index = new int[array.length];
int[] newIndex = new int[array.length];
int[] helpIndex;
int numEqual;
array = (double[])array.clone();
for (int i = 0; i < index.length; i++) {
index[i] = i;
if (Double.isNaN(array[... | 8 |
@Override
public Integer value(final Matrix<TypeOfValue> matrix) {
int column = this._column;
int lowRow = this._lowerRowBound;
int highRow = this._upperRowBound;
Operator<TypeOfValue, TypeOfValue, Boolean> comparer = this._comparer;
if (highRow < lowRow)
throw ne... | 9 |
@Override
public boolean isNotebookCorrect(Notebook memory) {
boolean isCorrect = true;
int numTestsSoFar = 0;
while (isCorrect && numTestsSoFar < numTests) {
final NotebookTester notebookTester = notebookTesterFactory.produceNotebookTester();
isCorrect &= notebookTes... | 2 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.