text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void mouseClicked(int button, int x, int y, int clickCount) {
switch (GameplayState.currentState) {
case PAUSED:
case PLACE:
case NORMAL:
this.gui.mouseClicked(button, x, y, clickCount);
break;
case WIN:
case LOSE:
this.gameOverUI.mouseClicked(button, x, y, clickCount);
break;
}
} | 5 |
public Object next() {
int pos = rand.nextInt(pool.size());
Iterator i = pool.iterator();
while (pos > 0)
i.next();
return (String) i.next();
} | 1 |
public DialogCase open() {
Shell dialog = createContent();
UI.centerShell(shell, dialog);
dialog.open();
while (!dialog.isDisposed()) {
if (!dialog.getDisplay().readAndDispatch())
dialog.getDisplay().sleep();
}
if (!dialog.isDisposed()) {
dialog.close();
}
return dialogOutput[0];
} | 3 |
public KorpaBean PotrosackaKorpa(KorisnikBean kb) throws Exception{
KorpaBean korpa = null;
try{
stmt=con.createStatement();
String query1 = "select * from potrosackakorpa where korisnikID=(select KorisnikId from korisnik where korisnickoIme = '"+kb.getKorisnickoIme()+"' ) A... | 5 |
public void testWithStartInstant_RI2() {
Interval test = new Interval(TEST_TIME1, TEST_TIME2);
try {
test.withStart(new Instant(TEST_TIME2 + 1));
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public static int maxProfit(int[] prices) {
int profit=0;
if(prices.length <= 0) return profit;
for(int i=0;i<prices.length-1;i++){
if(prices[i+1]-prices[i] >0)
profit+=prices[i+1]-prices[i];
}
return profit;
} | 3 |
@Override
public void union(Vector vector, VectorVectorMapper callback) {
int size = Math.max(size(), vector.size());
for(int i=0; i<size; i++) {
float v1 = get(i);
float v2 = vector.get(i);
if (v1 != 0 || v2!= 0) {
if (!callback.map(i, v1, v2)) {
... | 4 |
public void addCalendar(boolean weekView, Date date)
{
JPanel container = new JPanel();
FlowLayout panelLayout = new FlowLayout();
panelLayout.setHgap(0);
panelLayout.setVgap(0);
container.setLayout(panelLayout);
scrollPane = new JScrollPane(container);
if (weekView == true)
{
int width = 100;
... | 5 |
public static boolean insertlistcheck (Connection conTst ) throws SQLException {
boolean chk = true;
boolean doCreate = false;
try {
Statement s = conTst.createStatement();
s.execute("update SYSTEMINSERT set ENTRY_DATE = CURRENT_TIMESTAMP, INSERT_ITEM = 'TEST ENTRY' where 1=3");... | 4 |
public Disparo doDisparar(TipoDisparo tipo, Posicion posicion){
Disparo disparo = null;
switch(tipo){
case CONVENCIONAL:
disparo = new Convencional(this, posicion);
disparo.setCosto(200);
this.disparar((Convencional) disparo);
break;
case MINA_SIMPLE:
disparo = new MinaRetardada(this, posi... | 5 |
private void updateState(boolean sevenedOut) {
if (isNumberEstablished()) {
if (dice.getTotal() == 7 || dice.getTotal() == number)
number = 0;
} else {
if ((dice.getTotal() >= 4 && dice.getTotal() <= 6) ||
(dice.getTotal() >= 8 && dice.getTotal() <= 10))
number = dice.getTotal();
}
RollComple... | 9 |
protected boolean isSubTypeOf(final Value value, final Value expected) {
Type expectedType = ((BasicValue) expected).getType();
Type type = ((BasicValue) value).getType();
switch (expectedType.getSort()) {
case Type.INT:
case Type.FLOAT:
case Type.LONG:
case Type.DOUBLE:
return type.equals(expectedType... | 9 |
@Override
public String toString() {
StringBuilder string = new StringBuilder(game.name)
.append(" - (")
.append(game.getTick())
.append(":")
.append(String.format("%.3f", (double) game.getFrames() / game.getTick()))
.append("):... | 5 |
public void print(){
for(int k=1;k<=cols;k++){
System.out.print(vnames[k]+"\t");
}
System.out.print("\n");
for(int k=1;k<=cols;k++){
System.out.print(vunits[k]+"\t");
}
System.out.print("\n");
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
System.out.print(vls[i][j]+"\t");
... | 4 |
public void writeCONTROL_REG(int /* reg8 */control) {
waveform = (control >> 4) & 0x0f;
ring_mod = control & 0x04;
sync = control & 0x02;
int /* reg8 */test_next = control & 0x08;
if (ANTTI_LANKILA_PATCH) {
/*
* SounDemoN found out that test bit can be used to control the
* noise register. Hear t... | 8 |
public void setGoalGradMerged() {
// set high values
for (int row = 0; row < Board.getNbRows(); row++) {
// for each col
for (int col = 0; col < Board.getNbCols(); col++) {
goalGradMerged[row][col] = -1;
}
}
int value;
... | 8 |
public static void main(String args[]) {
int x;
for (x = 0; x < 6; x++) {
if(x == 1)
System.out.println("x is one");
else if (x == 2)
System.out.println(" x is two");
else if (x == 3)
System.out.println(" x is t... | 5 |
protected static void search(ProcessSearchRentacars processSearchRentalcars) {
StringBuffer stringBuffer = new StringBuffer(TravelSDK.INSTANCE.getSettingsResult().getWsUrl());
stringBuffer.append("?prgm=rentacar.search");
TravelSDK.appendStandartServiceParameters(stringBuffer);
stringBuffer.append("&limit=").ap... | 5 |
private void initA() {
A = new HashSet<Edge>();
vertex = new HashSet<Integer>();
// copy edges:
ArrayList<Edge> ce = new ArrayList<Edge>(edges);
int cost = ce.get(0).getweight();
Edge anedge = ce.get(0);
// 1. find a least cost edge and insert to A as first Edge
for (Edge E : ce) {
if (E.getweight() ... | 9 |
public void setMasterVolume(float masterVolume) {
this.masterVolume = masterVolume;
adjustVolume = true;
if(background != null)
background.adjustVolume(masterVolume);
} | 1 |
protected void moveCar(int[] nextCoordinates) throws GameEndException{
if(countMoves > 10000/waitingDuration){
throw new GameEndException("Car " + name + " has " + getPoints() + " points");
}
if(nextCoordinates[0] != -1){
this.x = nextCoordinates[0];
this.y = nextCoordinates[1];
Field newField = ... | 5 |
void deviceAdded (Device dev, DefaultTreeModel model)
throws IOException
{
HubNode h = getHubOf ("add", dev);
if (h == null) {
System.err.println ("what hub has " + dev);
return;
} else if (h != this) {
h.deviceAdded (dev, model);
return;
}
synchronized (children) {
for (int i... | 6 |
public static JButton getAttackButton() {
if (attackButton == null) {
attackButton = new JButton("Attack");
attackButton.setEnabled(false);
attackButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (GameData.COLLECT_ROUND == true) {
gameLabel.setTe... | 6 |
public int compareToNumbers(double n1, double n2, String name1, String name2, boolean descending) {
int order = (descending ? -1 : 1);
// Both are NaN => compare strings (always in alphabetical order)
if (Double.isNaN(n1) && Double.isNaN(n2)) { return name1.compareTo(name2); }
// One of them is NaN? (when sor... | 7 |
public void push(String stack, E element) {
synchronized(lock) {
if(STACK1.equals(stack)) {
array[tail1++] = element;
if(tail1 >= array.length/3-1) {
resize();
}
} else if (STACK2.equals(stack)) {
array[tail2--] = element;
if(tail2 <= tail3+1) {
resize();
}
} else if (STACK3... | 6 |
private Scene createPreloaderScene() {
loading = new Loading();
try {
loading.buildComponents();
} catch (IOException ex) {
}
return loading.getScene();
} | 1 |
public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
mv.visitFieldInsn(opcode, owner, name, desc);
if (constructor) {
char c = desc.charAt(0);
boolean longOrDouble = c == 'J' || c == 'D';
switch (opcode) {
case GETSTATIC:
pushValue(OTHER);
... | 9 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
private void cppPrintMethodSignature(Method m, boolean isImplementation, boolean isStatic) throws ClassNotFoundException
{
out.print("\t" + (isStatic && !isImplementation ? "static " : ""));
cppPrintType(m.getReturnType(), false);
if (isImplementation)
out.print(classNameWithUnderscores + "::");
out.... | 9 |
private static int fastSq(int base, int power) {
if (power == 1) {
return base;
} else if (power == 0) {
return 1;
} else if (power % 2 == 0) {
return (int) Math.pow(fastSq(base, power / 2), 2);
} else {
return (int) (Math.pow(fastSq(base, power / 2), 2) * base);
}
} | 3 |
public String getStringWithDefault(String entry, String defaultEntry) {
String result = getString(entry);
if (result == null) {
result = getString(defaultEntry);
}
return result;
} | 1 |
public GameOptions() {
setResizable(false);
setBounds(100, 100, 267, 221);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(null);
final JToggleButton tglbtnDefaultMaze = ne... | 8 |
public static void ReadFromFile(String fileName){
BufferedReader br = null;
try{
br = new BufferedReader(new FileReader(fileName));
String line = null;
while((line = br.readLine()) != null){
HashMap<Integer, ArrayList<Double>> geneEntry = new HashMap<I... | 5 |
private void getOldMods(){
Patch_Controller.delete(new File(Strings.TEMPORARY_DATA_LOCATION_B));
UnZip.unZipIt(Strings.MODDEDZIP_LOCATION, Strings.TEMPORARY_DATA_LOCATION_B);
ArrayList<Integer> rows = new ArrayList<Integer>();
ArrayList<Integer> rows1 = new ArrayList<Integer>();
try {
ArrayList<String[]> ... | 7 |
public String toString() {
String s;
s = "Vertices:\n";
for (int i=0; i < current; i++) {
s += " " + i + ": " + locations[i].getName() + "\n";
}
s+="\n";
s += "Edges:\n";
for (int i=0; i < current; i++) {
for (int j=0; j < i; j++) {
if (adjacent[i][j]) {
s+=" ... | 4 |
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 fe... | 6 |
public static int getBillTotalCost(int billId) {
int total = 0;
String query = "SELECT ifNull(sum(`cost` * `quantity`),0) + `consultationCost` as `total` "
+ "FROM `bill` "
+ "LEFT JOIN `billItem` on `bill`.`billId` = `billItem`.`billId` "
+ "LEFT JOIN `m... | 3 |
public void move(boolean isLeft) {
if (this.getLeft() <= 0 && moveInt == 1) {
this.setMoveInt(0);
x = 1;
} else if (this.getRight() >= 500 && moveInt == 2) {
this.setMoveInt(0);
x = 499 - width;
}
if (isLeft) {
x -= 5;
}... | 5 |
public void testPropertyAddNoWrapHour() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
TimeOfDay copy = test.hourOfDay().addNoWrapToCopy(9);
check(test, 10, 20, 30, 40);
check(copy, 19, 20, 30, 40);
copy = test.hourOfDay().addNoWrapToCopy(0);
check(copy, 10, 2... | 2 |
public ArrayList<Patch> getTargetsInRange(int r){
ArrayList <Patch> ans = new ArrayList();
ArrayList <Patch> temp = new ArrayList();
ans.addAll(getPatch().getNeighbors4());
while (r > 0){
for (int i = 0; i<ans.size();i++){
if (ans.get(i).getTurtle()==null||(an... | 4 |
public FenPrincipale() {
initComponents();
this.nomAnimal = "Aucun animal";
this.positions = new ArrayList();
this.positionsAff = new ArrayList();
nbrPointsAff = sliderNbrPoints.getValue()+1;
nbrPointsAffiche = Integer.toString(nbrPointsAff);
cho... | 0 |
public int getDegree(final City city) {
int index = getIndex(city);
if (index < 0) {
return -1;
}
int degree = 0;
for (int[] edge : edges) {
for (int x = 0; x < edge.length; x++) {
if (x == index && edge[x] != 0) {
degre... | 5 |
public void writeVariable(CycVariable cycVariable)
throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeVariable = " + cycVariable.toString());
}
final String name = cycVariable.toString();
if (cycVariable.isHLVariable()) {
write(CFASL_COMPLE... | 2 |
public Hospital getHospitalidHospital() {
return hospitalidHospital;
} | 0 |
@Override
public void setMemoryAllocation(int[] memory) {
DefaultTableModel mdlMemory = new DefaultTableModel();
if (memory != null && memory.length > 0) {
for(int i = 0; i < memory.length; i++) {
if (memory[i] > -1) { //If value is -1 then leave it blank
mdlMemory.addColumn(i, new Object[]{memory[i]})... | 5 |
private ReflectUtils()
{
} | 0 |
public static void MWF() throws IOException{
int timeblock = 5;
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
while (timeblock > 0){
System.out.println("What would you like to do right now?");
if (timeblock >= 3)
{
System.out.println("1. Go to class (not likely)");
... | 7 |
public void loadFromObject() { try {
if (cls==null) return;
for (int i=0; i<fields.size(); i++) {
String fieldname = (String)fields.get(i);
String fieldtype = (String)fieldtypes.get(fieldname);
//System.out.println("<field "+fieldname+" "+fieldvalue);
if (fieldtype.equals("key")
|| fieldtype.equals(... | 9 |
private void txtPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPasswordActionPerformed
String username,stringPass="";
char[] pass;
String passHash="";
username=this.txtUsername.getText();
pass=this.txtPassword.getPassword();
for(int... | 7 |
int insertKeyRehash(char val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... | 9 |
private void jButton0MouseMouseClicked(MouseEvent event) {
this.dispose();
} | 0 |
public void choixDuGeneral(Set<Joueur> hjoueur, Set<General> hgeneral){
Scanner sc = new Scanner(System.in);
String nomgeneral = new String();
for(Joueur j : hjoueur){
boolean isCorrect = false;
// On vérifie que le choix du général est bien possible (pas déjà pr... | 6 |
private void splitImage()
{
int vertical = ytrans[0].length / 8;
int horizontal = ytrans.length / 8;
for(int y = 0; y < vertical; y++)
{
for(int x = 0; x < horizontal; x++)
{
int xoff = (x * 8);
int yoff = (y * 8);
double[][] Y = new double[8][8];
double[][] Cb = new double[8][8];
... | 8 |
public static short parse_serial_parameter(final String cur_serial_data, boolean highlight, byte show_device_flags)
{
if (show_device_flags == SHOW_DEVICE_NONE)
return ANALYZER_SUCCESS;
String title = null;
String content = null;
String date = null;
String time = null;
String number = null;
String se... | 8 |
public boolean doLogin(String username, String password){
PreparedStatement preparedStatement;
ResultSet resultSet;
String dbPassword = null;
PasswordService passwordService = new DefaultPasswordService();
Connection connection = DatabaseConnection.connectDB();
// be cons... | 4 |
public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 64
// do, line 66
v_1 = cursor;
lab0: do {
// call mark_regions, line 66
... | 8 |
private static TypedObject parseObject(LinkedList<Character> json)
{
TypedObject ret = new TypedObject(null);
char c = json.removeFirst();
if (c == '}') // Check for empty object
return ret;
json.addFirst(c);
do
{
json.removeFirst(); // Read quote
String key = parseString(json);
json.remove... | 2 |
public void convertPointsToShape(){
if(allData.size()!=0) return;
try{
for(int i=0; i<allPoints.size(); i++){
SeShape shape = new SeShape();
ArrayList<SDEPoint> points = allPoints.get(i);
//convert to array of SDEPoint
SDEPoint pts[] = new SDEPoint[points.size()];
for(int j=0; j<pts.leng... | 4 |
public static Object fromByteArray(byte[] array){
try{
ByteArrayInputStream bis = new ByteArrayInputStream(array);
ObjectInput in = null;
in = new ObjectInputStream(bis);
Object o = in.readObject();
try{
bis.close();
in.close();
}catch(Exception e){System.out.println("A Memory Leak Has Happ... | 2 |
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if(l1 == null)
return l2;
else if(l2 == null){
return l1;
}
ListNode head = new ListNode(-1);
ListNode index = head;
while(l1 != null && l2 != null){
if(l1.val > l2.val){
... | 6 |
private void getEndElement(String name) throws MiniXMLException {
MiniXMLToken oMiniXMLToken;
boolean bEnd = false;
// String attrName, attrValue;
MiniXMLEndElement element = new MiniXMLEndElement(
automaton.getStateInt(), name);
automaton.endElement(name);
// System.out.print("</" + name);
do {
oM... | 3 |
public Final fingFinalByValues(List<String> values){
for(String value : values){
Final finalElement = findFinalByValue(value);
if(finalElement != null)
return finalElement;
}
return null;
} | 2 |
private void timerActie(){
if(baanTeller < baanPad.size()){
volgendeStapAfgelegdeBaan();
if(baanTeller == baanPad.size()){
try{
onCompleteFunc.call(); //moet gecalld worden op de voorlaatste stap van de animatie
} catch(Exception e){
... | 3 |
public void testBuildInitialization() {
String[][][] results;
Instances inst;
int i;
int n;
int m;
results = new String[2][m_Instances.numInstances()][m_NumNeighbors];
// two runs of determining neighbors
for (i = 0; i < 2; i++) {
try {
m_NearestNeighbourSearch.se... | 7 |
private void doQueryRound(int n, int range)
{
Future<RPCMessage> futureReply;
int i=0;
int rangeCounter=1;
Iterator<Contact> it = shortList.iterator();
Contact c;
while (it.hasNext() && rangeCounter <= range && i < n)
{
c = it.next();
//if c is unprobed and it is not the local node then que... | 9 |
public void layout(Graph g, Set notMoving) {
graph = g;
ArrayList vertices = getMovableVertices(graph, notMoving);
if (graph==null || vertices.size() == 0)
return;
/* After checking to see if the graph has movable vertices, sort the vertices
* degree in the graph, and then insert them in a VertexChain ... | 6 |
* @param id 選択レコードのID
*/
private void setTblData(boolean selectedQuery, String selectedId) {
// ソート解除
for (int i=0; i<recTable.getColumnCount(); i++) {
recSorter.setSortingStatus(i, TableSorter.NOT_SORTED);
}
DefaultTableModel dataModel = (DefaultTableModel)recSorter.getTableModel();
dataModel.set... | 8 |
public static Path findDoorToDoorPath(Door start, Door end) {
double[][] adjacency;
if (start.equals(end)) {
Path result = new Path(start.getCentralPoint(),
end.getCentralPoint());
result.add(start.getCentralPoint());
return result;
}
try {
adjacency = SimulationEngine.getInstance().getWorld()
... | 5 |
public void setVue(VueAbstraite vue) {
this.vue = vue;
} | 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 |
public void executeCommand(final String... inputs) throws IOException {
final ArrayList<String> commands = new ArrayList<String>();
commands.add("c:/windows/system32/cmd.exe");
commands.add("/c");
for (String x : inputs) {
commands.add(x);... | 4 |
private static boolean allSameFormat(List<String> input, ArrayList<SECTION_ALIGN> order) {
int n = 0;
if (order == null) {
order = getAlignOrder(input.get(0));
++n;
}
// now check that remainder follow this order
for (; n < input.size(); ++n) {
String line = input.get(n);
int formatNum = 0;
for... | 8 |
@Override
protected void shutdownOutput () throws IOException {
if ( !this.closed && this.fd.valid() ) {
NativeUnixSocket.shutdown(this.fd, SHUT_WR);
}
} | 2 |
public void generateNet (int length, int width) {
ArrayList<Node> firstLayer = new ArrayList<Node>();
ArrayList<Node> secondLayer = new ArrayList<Node>();
// populate the first layer
for (int i = 0; i < width; i++) {
InputNode firstNode = new InputNode(getNextId());... | 8 |
public void actionPerformed(ActionEvent e){
if(e.getSource().equals(timer)){
model.updatePositions();
view.update();
timeCounter += (int)timer.getDelay();
if(record){
try {
skrivfil();
} catch (IOException e1) {}
}
}
if(e.getSource().equals(recordButton)){
if(!record){record=true;
} el... | 9 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
request.setCharacterEncoding("UTF-8");
User loggedIn = (User) session.getAttribute("loggedIn");
String na... | 6 |
@Override
public Date decodeFromString(String value) throws Exception {
if (value.contains("y")) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, Calendar.JANUARY);
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
... | 5 |
static boolean seq_valid(int[] seq)
{
int j;
boolean positive = false;
boolean pred_not = false;
boolean operand = false;
for(j=0;j<SEQ_MAX;++j)
{
switch ((seq)[j])
{
case CODE_NONE :
break;
case CODE_OR :
if (!operand || !positive)
re... | 9 |
private static byte[] readPasswordFromHex(String hexPassword) {
byte[] passwordBytes = new byte[hexPassword.length() / 2];
for (int i = 0; i < passwordBytes.length; i++) {
passwordBytes[i] = (byte) Integer.parseInt(hexPassword.substring(2 * i, 2 * i + 2), 16);
}
return passwo... | 1 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Roles)) {
return false;
}
Roles other = (Roles) object;
if ((this.rolidRol == null && other.rolidRol != null) |... | 5 |
@Test
public void testDuplicateAnalyzerMethods() throws IOException, TesseractException {
// HACK: this will be impossible to maintain. Need a better way to identify and
// test methods that should fail (possibly reflection)
ImageAnalyzerFactory factory = TestContext.getImageAnaylzerF... | 5 |
public boolean validargrado(String Grado) {
boolean correcto = false;
String[] rrecorregrado = Grado.split("-");
// for (int i = 0; i < rrecorregrado.length; i++) {}
try {
if (esnumero(rrecorregrado[0]) && esnumero(rrecorregrado[1]) && Integer.parseInt(rrecorregrado[0]) <= ... | 7 |
@Override
public boolean equals(Object r) {
return r != null && r instanceof Reponse && getId() == ((Reponse)r).getId();
} | 2 |
private void playSong(){
if(songStatus == SONG_STOPPED){
Song selectedSong = playerLibrary.getSongByIndex(titlesList.getSelectedIndex());
myPlayer = new MP3Player(selectedSong);
new Thread(myPlayer).start();
songStatus = SONG_PLAYING;
songInfoField.set... | 2 |
public String addRoute(List<String> stationsForNewRoute, String routeName) throws IOException {
String message = "";
log.debug("Start method \"addRoute\"");
if (stationsForNewRoute.size() <= 1) {
message = "Маршрут должен содержать больше одной станции";
return message;
... | 6 |
public static void main(String[] args) {
// TODO Auto-generated method stub
String Driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectStr = "jdbc:odbc:test";
try {
Class.forName(Driver);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
Co... | 3 |
public boolean removeID(String ID)
{
boolean OK = false;
OK = IDList.remove(ID); //If false, then ID not found!
IDList.remove(ID);
System.out.print(IDList);
if( OK )
{
int gradeHistIndex = Integer.parseInt( ID.substring(0,1) );
gradesHist.set(gradeHistIndex, new Integer(( (Integer)gradesHist.get(grad... | 2 |
private void jButton9MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton9MouseReleased
// TODO add your handling code here:
//System.out.println(this.CommandBox.getSelectedIndex());
switch ( this.CommandBox.getSelectedIndex() ) {
case 0:
comm... | 8 |
public static void evaluate_queue(String type) {
System.out.println("Evaluating " + type + " queue +++++++++++++++++++");
int total_ops = 25000;
int[] n_threads_arr = {2, 3, 4, 5, 6};
for (int t = 0; t < n_threads_arr.length; t++) {
int n_threads = n_threads_arr[t];
System.out.println("For " + n_threads +... | 9 |
public boolean validFile() throws NullPointerException {
String regex = "(<notestore)(.*)(nextId=\")(\\d+)(\">)(.*)(<\\/notestore>)";
Pattern p = Pattern.compile(regex, Pattern.DOTALL);
Matcher m = p.matcher(data);
if(m.find()) {
regex = "(<note>)(.*?)(<\\/note>)";
p = Pattern.compile(regex, Pattern.DO... | 6 |
private final void method740(AbstractToolkit var_ha, Class72 class72_60_) {
Model class124
= Class300.createModel(0, Class260.aClass45_3309, anInt1224);
if (class124 != null) {
var_ha.getDimensions(anIntArray1226);
var_ha.setDimensions(0, 0, anInt1220, anInt1220);
var_ha.drawQuad(0, 0, anInt1220, ... | 6 |
public void mouseDragged(MouseEvent e) {
if(e.isControlDown())
{
markerRect.draw();
markerRect.setWidth(-(mouseStartX-e.getX()));
markerRect.setHeight(-(mouseStartY-e.getY()));
repaint();
}
/* else if(markerRect.isSelectedDrag())
... | 1 |
private boolean jj_3_15() {
if (jj_3R_33()) return true;
return false;
} | 1 |
@Override
public void draw() {
glColor3d(255, 204, 0);
Rectangle bounds = getAbsoluteRect();
glBegin(GL_QUADS);
glVertex3i(bounds.x + width, bounds.y, 0);
glVertex3i(bounds.x + width, bounds.y + height, 0);
glVertex3i(bounds.x, bounds.y + height, 0);
glVertex3i(bounds.x, bounds.y, 0);
glEnd();
} | 0 |
private Chunk generate(Point p)
{
Chunk c = new Chunk((new Random()).nextInt(Chunk.NUM_BIOMES-1), 0, p);
if (p.x == 0 && p.y == 0)
{
ArrayList<Villager> population = new ArrayList<Villager>();
population.add(new Villager());
population.add(new Villager());
population.add(new Villager());
populatio... | 2 |
@Override
/**
* Issues actions to units
*@param gs the game state
*@param time_limit how much time is given for this turn (msec)
*/
public void getAction(GameState gs, int time_limit) {
turn_start = System.currentTimeMillis();
turn_limit = time_limit;
state = gs;
current_turn++;
if (!init) {
... | 8 |
private void runTree(RBNode root) {
if (root != nil) {
if (root.getColor() == Color.BLACK) {
treeStr.add(root.getKey() + " [style=filled,color=black,fontcolor=white];");
} else {
treeStr.add(root.getKey() + " [style=filled,color=red];");
}
... | 4 |
public static Visualization Fusion(Visualization visu1, Visualization visu2) throws IncompatibleIndexAxisException {
Visualization visualization = new Visualization();
for(Resource resource : visu1.getResources())
visualization.addResource(resource);
for(Resource resource : visu2.get... | 6 |
public List<String> getWords(){
List<String> res = new ArrayList<String>();
for (int x = 0; x < points.length; x++) {
for (int y = 0; y < points.length;y++) {
Point[][] points = getPointArray(x, y);
Point[] word = new Point[WORD_LENGTH];
Boole... | 9 |
public void testDefaultSecurity() {
if (OLD_JDK) {
return;
}
try {
Policy.setPolicy(RESTRICT);
System.setSecurityManager(new SecurityManager());
DateTimeZone.setDefault(PARIS);
fail();
} catch (SecurityException ex) {
... | 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.