text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void setVoltageColor(Graphics g, double volts) {
if (needsHighlight()) {
g.setColor(selectColor);
return;
}
if (!sim.isShowingVoltage()) {
if (!sim.isShowingPowerDissipation()) // && !conductanceCheckItem.getState())
{
g.setC... | 6 |
void resampleProcess() throws FileNotFoundException{
//Scan entries in the index
java.util.Iterator<Entry<String, long[]>> iter = index.entrySet().iterator();
long conNo ;
int evictCount=0;
while(iter.hasNext()){
entryCount++;
long meta[] = iter.next().getValue();
if(meta[0]<=threshold && evictCount < samp... | 9 |
public static void greyWriteImage(double[][] data){
//this takes and array of doubles between 0 and 1 and generates a grey scale image from them
BufferedImage image = new BufferedImage(data.length,data[0].length, BufferedImage.TYPE_INT_RGB);
for (int y = 0; y < data[0].length; y++)
{
... | 5 |
static void selection_sort(int num[]) {
int pivot,min,pos=0;
for (int i=0;i<num.length-1;i++) {
pivot=num[i];min=num[i+1];
for (int j=i+1;j<num.length;j++) {
if(num[j]<=min) {
min=num[j];
pos=j;
}
}
if(min<pivot) {
temp=pivot;
num[i]=min;
num[pos]=temp;
}
... | 5 |
public void addNewNPC(NPC npc, stream str, stream updateBlock)
{
int id = npc.npcId;
npcInListBitmap[id >> 3] |= 1 << (id&7); // set the flag
npcList[npcListSize++] = npc;
str.writeBits(14, id); // client doesn't seem to like id=0
int z = npc.absY-absY;
if(z < 0) z += 32;
str.writeBits(5, z); // y co... | 2 |
public Scores copy( )
{
// create new Scores object
Scores temp = new Scores();
// make it identical to 'this' object
for (int i=0; i<grades.length; i++)
{
temp.grades[i] = grades[i];
}
// return the copy
return temp;
} | 1 |
public Wall(int x,int y)
{
super(x,y);
} | 0 |
private void connect() {
graph.addGraphListener( graphListener );
for( GraphItem item : items() ) {
graphListener.itemAdded( graph, item );
}
} | 1 |
final static public void optionWriter(String attrib, String content)
{
File configf = new File(Start.sport, "config.txt");
String[] inhalt = null;
boolean inside = false;
if(configf.exists())
{
try
{
inhalt = Textreader(configf);
}
catch (IOException e) {}
for (int i=0; i<inhalt.l... | 7 |
public static void removeDupesHeadside(Vector someVector) {
// we'll be storing census info here
TreeSet censusTree = new TreeSet() ;
if (censusTree == null) {
return ;
} // end if
// grab the vector's starting size
int size = someVector.size() ;
// starting at the tail
int position = size - ... | 4 |
@Override
public int compareTo(Interval i2) {
// Start
if (start > i2.start) return 1;
if (start < i2.start) return -1;
// End
if (end > i2.end) return 1;
if (end < i2.end) return -1;
return 0;
} | 4 |
public static List<Car> getFreeCars() throws LoginLogicException {
List<Car> freeCars = new ArrayList<Car>();
Connection connection = null;
try {
connection = ConnectionPool.getInstance().takeConnection();
// ������������������ �������� ������������������ ���������� �� ��������������
AbstractDAO<Car> ... | 7 |
private String display() {
String displayString = "";
if (data == null) {
return displayString;
}
displayString += data.toString();
return displayString;
} | 1 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cost == null) ? 0 : cost.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result
+ ((partNumber == null) ? 0 : partNumber.hashCode());
result = prime * result
... | 8 |
public FoodItem orderFoodItem(String foodItemName) {
return getFoodItem(foodItemName);
} | 0 |
public List<Integer> getShortedPath(Integer start, Integer stop) {
dijkstra(start, stop);
vertex.clear();
distance.clear();
Integer i = stop;
ArrayList<Integer> path = new ArrayList<>();
while(i != start && i != null) {
i = predecessors.get(i);
if(i != null && !i.equals(start)){
path.add(i);
}... | 4 |
public final BufferedImage loadImage(URL imageName) {
if (imageName == null)
throw new NullPointerException("AssetLoader.loadImage: NULL parameter supplied.");
BufferedImage image = null;
try {
// Attempt to load the specified image and then create a compatible
... | 4 |
public boolean updateSongMetadata(MusicObject newEntry,MusicObject oldEntry) throws SQLException {
if (connection == null) {
connection = getConnection();
}
if (updateSongStmt == null) {
updateSongStmt = connection.prepareStatement("UPDATE org.MUSIC " +
"SET song_name = ?, "+
"file_hash = ?,... | 3 |
public String makeMove(CardGame game) {
if (boardIndexTo != -1) {
switch (moveType) {
case FROM_DECK:
return makeDeckMove(game);
case FROM_BOARD:
return makeBoardMove(game);
case FROM_PILE:
re... | 4 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Set<MOB> h=properTargets(mob,givenTarget,auto);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth scaring."));
return false;
}
if(!super.invoke(mob,commands,gi... | 8 |
private void initNextItem(boolean advance) {
if (this.endOfPage) {
nextBlock = null;
return;
}
if (advance) {
if (!iterator.next(Level.BLOCK)) {
this.endOfPage = true;
return;
}
}
try {
... | 5 |
public void addRecipe() {
for (int i = 0; i < 4; i++)
{
GameRegistry.addRecipe(
new ItemStack(DCsFenceSlab.fenceslabW, 6, i),
new Object[]{" X ","XXX",
Character.valueOf('X'), new ItemStack(Block.planks,1,i)});
}
for (int i = 0; i < 8; i++)
{
I... | 9 |
public static HashMap<String, File> prepareDictionaryFiles(String path){
File dir = new File(path);
if (!dir.isDirectory()){
return null;
}
HashMap<String, File> map = new HashMap<String, File>();
File[] files = dir.listFiles();
for (File file : files){
if (!file.isFile()){
continue;
}... | 6 |
@BeforeClass
public static void setUpClass() {
} | 0 |
public void visit_ifgt(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} | 1 |
private void isEqualToDate(final Object param, final Object value) {
if (value instanceof Date) {
if (!((Date) param).equals((Date) value)) {
throw new IllegalStateException("Dates are not equal.");
}
} else {
throw new IllegalArgumentException();
}
} | 2 |
public String getShortcutToolTip() {
String tip = getToolTip();
KeyStroke stroke = getKey();
if (stroke == null)
return tip;
int index = findDominant(tip, stroke.getKeyChar());
if (index == -1)
return tip + "(" + Character.toUpperCase(stroke.getKeyChar()) + ")";
return tip.substring(0, index) + "(" + ... | 2 |
void rehashPostings(final int newSize) {
final int newMask = newSize-1;
RawPostingList[] newHash = new RawPostingList[newSize];
for(int i=0;i<postingsHashSize;i++) {
RawPostingList p0 = postingsHash[i];
if (p0 != null) {
int code;
if (perThread.primary) {
final int st... | 7 |
private Integer calVer(String s) throws NumberFormatException
{
if (s.contains(".")) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
final Character c = s.charAt(i);
if (Character.isLetterOrDigit(c)) {
... | 3 |
public void setCode(long value) {
this._code = value;
} | 0 |
public void creaAutomataCerradura(int tipoCerradura) {
try {
if (tipoCerradura == 0) {
System.out.println("Generando automata para cerradura epsilon...");
} else {
System.out.println("Generando automata para cerradura positiva...");
}
... | 3 |
protected App() {
if (Platform.isMacintosh()) {
Application app = Application.getApplication();
app.setAboutHandler(AboutCommand.INSTANCE);
app.setPreferencesHandler(PreferencesCommand.INSTANCE);
app.setOpenFileHandler(OpenCommand.INSTANCE);
app.setPrintFileHandler(PrintCommand.INSTANCE);
app.setQui... | 1 |
public ArrayList<Integer> spiralOrder(final List<List<Integer>> a) {
ArrayList<Integer> result = new ArrayList<Integer>();
boolean left = true;
boolean right = false;
boolean top = false;
boolean down = false;
int lci = 0;
int rci = a.get(0).size() -1;
int tri = 0;
int bri =... | 9 |
public void append(String fileName,String message){
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(fileName,true));
writer.write(message);
writer.close();
}catch (java.io.IOException e) {
this.plugin.logMessage("Unable to write to "+fileName+": "+e.getMessage());
}
} | 1 |
public static void main(String[] args) {
System.out.println(Runtime.getRuntime().availableProcessors());
} | 0 |
public JPanel getMiscMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.misc;
} | 1 |
public boolean femaleAgree() {
if ((passion <= 80) && (this.previousAction != 3))
return true;
return false;
} | 2 |
public void addFishes(Fishes fishes) {
Iterator<Fish> ite = fishes.Iterator();
while (ite.hasNext()) {
Fish fish = ite.next();
for (int i = 0; i < fishContainers.size(); i++) {
if (fishContainers.get(i).getName().equals(fish.getName())) {
if (fishContainers.get(i).getMin() <= fish.getLength()
... | 5 |
protected boolean in_grouping_b(char [] s, int min, int max)
{
if (cursor <= limit_backward) return false;
char ch = current.charAt(cursor - 1);
if (ch > max || ch < min) return false;
ch -= min;
if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false;
cursor--;
return true;
} | 4 |
private static Controller getController(final String uri,
final String method) throws GameServerException {
if (uri.matches(LOGIN_SUFIX_PATTERN) && method.equals(GET_METHOD)) {
return ApplicationContext.getLoginController();
} else if (uri.matches(POST_SCORE_PATTERN)
&& method.equals(POST_METHOD)) {
r... | 6 |
public void setzPhase(int startEinheiten) {
while(startEinheiten > 0) {
spieler1.einheitenSetzen(1, laenderGraph);
wechsleSpieler(aktuellerSpieler);
spieler2.einheitenSetzen(1, laenderGraph);
wechsleSpieler(aktuellerSpieler);
startEinheiten--;
}
} | 1 |
public static long removeAddress(Address address, long sessionID) throws SessionException {
if (sessionID <= NO_SESSION_ID) {
throw new SessionException("A valid session ID is required to remove an address",
SessionException.SESSION_ID_REQUIRED);
}
Contact contact... | 3 |
private Iterator<Entry<String, String>> getTemplateLocations() {
final Log log = getLog();
List<Resource> r = this.resources;
//If no resources specified
if (r == null) {
final Resource resource = new Resource();
resource.source = new FileSet();
... | 5 |
public ContextFreeGrammar convertToContextFreeGrammar(Automaton automaton) {
/** check if automaton is pda. */
if (!(automaton instanceof PushdownAutomaton))
throw new IllegalArgumentException(
"automaton must be PushdownAutomaton");
if (!isInCorrectFormForConversion(automaton))
throw new IllegalArgum... | 4 |
private void submit(Schedule schedule, Teacher teacher)
{
String error = "";
if(schedule == null)
{
error += " - schedule \n";
}
if(teacher.getId() <= 0)
{
error += " - teacher \n";
}
if(schedule != null && teacher.getId() > 0){
//Component c = tabbedPane.getSelectedComponent();
this.group_... | 4 |
public FullPalletTest() {
ArrayList<CSIColor> list = new ArrayList<CSIColor>();
for (int i = 0; i < CSIColor.FULL_PALLET.length; i++) {
list.add(CSIColor.FULL_PALLET[i]);
}
Collections.sort(list);
try {
mainInterface = new WSwingConsoleInterface("CSIColo... | 9 |
public void removeLoginListener(LoginListener listener){
loginListeners.remove(listener);
} | 0 |
public void initializeServerWithPersistDataInServer() throws IOException,
CubeXmlFileNotExistsException, DocumentException,
CubeAlreadyExistsException,
CorrespondingDimensionNotExistsException,
SchemaAlreadyExistsException,
CorrespondingSchemaNotExistsExceptio... | 4 |
private Boolean checkType(String value, String dataType){
Boolean ret = false;
if( "#int".equals(dataType)){
try{
Integer.parseInt(value);
return true;
}catch(NumberFormatException e) {
return false;
}
}... | 7 |
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
Tourist person = new Tourist();
try {
person.takeTour();
// if an exception is thrown from previous line, this next
// instruction is not executed
System.out.printf("Tourist %d say: This is cool%n", i + 1);
} catch (TooHo... | 3 |
public static By parse(String elementLocator) throws InvalidSeleneseCommandArgumentException {
String matched;
for(ElementLocator locator : ElementLocator.values()) {
if((matched = locator.find(elementLocator)) != null) {
switch(locator) {
case ID : return By.id(matched);
case NAME : return By.na... | 7 |
/* */ public void run()
/* */ {
/* */ while (true)
/* */ {
/* */ try {
/* 157 */ Thread.sleep(17L);
/* */ } catch (Exception e) {
/* 159 */ e.printStackTrace();
/* */ }
/* */
/* 162 */ for (int i = 0; i < landingboats.size(); i++) {
/*... | 4 |
private Grammar trim(Production[] prods)
{
myVariableMap=new HashMap <String, String>();
char ch='A';
for (int i=0; i<prods.length; i++)
{
String lhs=prods[i].getLHS();
if (ch=='S' || ch=='T')
{
ch++;
}
int aa=lhs.indexOf("V(");
while (aa>-1)
{
// System.out.println("in 1st "+lh... | 8 |
private void handleEvents(int keyCode) {
switch (applicationState.getState()) {
case ApplicationState.MAIN_MENU:
handleMainMenu(keyCode);
break;
case ApplicationState.HELP:
case ApplicationState.ABOUT:
... | 7 |
private void createNetwork(int inputs,int outputs){
if(currentSpecies==null){
if(net==null){
System.out.println("Neural Network created in net");
net=new SpeciationNeuralNetwork(history,inputs,outputs);
if(net2==null)
currentNetwork... | 6 |
public synchronized void close() {
if (isClosed) {
return;
}
isClosed = true;
if (cycLeaseManager != null) {
cycLeaseManager.interrupt();
}
if (cycConnection != null) {
cycConnection.close();
}
if (areAPIRequestsLoggedToFile) {
try {
apiRequestLog.close();... | 7 |
@SuppressWarnings("unchecked")
void readGaussianBasis() throws Exception {
Vector sdata = new Vector();
Vector gdata = new Vector();
atomCount = 0;
gaussianCount = 0;
int nGaussians = 0;
shellCount = 0;
String thisShell = "0";
String[] tokens;
discardLinesUntilContains("SHELL TYPE PR... | 9 |
protected void onMouseClick(int var1, int var2, int var3) {
if(var3 == 0) {
for(var3 = 0; var3 < this.buttons.size(); ++var3) {
Button var4;
Button var7;
if((var7 = var4 = (Button)this.buttons.get(var3)).active && var1 >= var7.x && var2 >= var7.y && var1 < var7.x + var... | 7 |
@Override
public void setName(String name) {
this.name = name;
} | 0 |
public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (bodyBlock == oldBlock)
bodyBlock = newBlock;
else
return false;
return true;
} | 1 |
public void run() {
try {
boolean eos=false;
byte[] buffer=new byte[8192];
while(!eos) {
OggPage op=OggPage.create(source);
synchronized (drainLock) {
pageCache.add(op);
}
if(!op.isBos()) {
... | 8 |
public static String longToPlayerName(long l) {
if (l <= 0L || l >= 0x5b5b57f8a98a5dd1L) {
return null;
}
if (l % 37L == 0L) {
return null;
}
int i = 0;
char ac[] = new char[12];
while (l != 0L) {
long l1 = l;
l /= 37L;
ac[11 - i++] = VALID_CHARS[(int)(l1 - l * 37L)];
}
return new Strin... | 4 |
public void backup(int amount) {
inBuf += amount;
if ((bufpos -= amount) < 0)
bufpos += bufsize;
} | 1 |
public DVConstraints dvConstraints() throws ConstraintException {
final DVConstraints result = DataFactory.getInstance().createDVConstraints();
final Term term = getValue();
if (term.isVariable())
return result;
final Functor functor = (Functor) term;
if (functor.definitionDepth() == 0) {
for (final Exp... | 7 |
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i <= 1000; i++) {
if (i % 3 == 0 || i % 5 == 0) {
sum += i;
}
}
System.out.println(sum);
} | 3 |
private void create() {
shell = new Shell(SWT.APPLICATION_MODAL | SWT.CLOSE );
shell.setText("Project File Restore/Replace");
shell.setMinimumSize(450, 250);
GridLayout layout = new GridLayout(1,false);
shell.setLayout(layout);
layout.horizontalSpacing = 5;
layout.verticalSpacing = 5;
layout.makeColu... | 9 |
public void showTable() {
waitlb1.setVisible(true);
if (!l.isEmpty()) {
if (r2.isSelected()) {
if (tmpHead == null) {
tmpHead = l.get(0);
l.remove(0);
} else if (l.get(0).equals(tmpHead)) {
l.remove(0);
}
} else {
if (tmpHead != null && !l.get(0).equals(tmpHead)) {
l.add(0,... | 7 |
public static int highestNumberPerimeter(int upperBound) {
int perimeter = 1, a = 1, b = 1, c = 1, max = 0;
int[] numberOfCombinations = new int[upperBound];
// Initialize the array to all zeros
for (int i = 0; i < upperBound; i++) {
numberOfCombinations[i] = 0;
}
... | 9 |
public static int encontrarMultiplosDe7(int[] v, int a, int b){
if (a == b) {
if (v[a] % 7 == 0) return 1;
else return 0;
} else {
if (a < b) {
while (a < b) {
if (v[a] % 7 == 0) return 1 + encontrarMultiplosDe7(v, a + 1, b);
else return encontrarMultiplosDe7(v, a + 1, b);
}
} else {
... | 7 |
@Override
public void run() {
requestFocus();
Image image = new BufferedImage(800, 600, BufferedImage.TYPE_INT_ARGB);
while(isRunning)
{
Graphics g = image.getGraphics();
g.drawImage(Images.background,0,0,null);
level.render(g);
g.dispose();
level.tick(input);
try
{
g = getGra... | 2 |
boolean releaseSystemKey(int keyValue){
try{
Robot r = new Robot();
r.keyRelease(keyValue);
if( isShift==true )
shiftOff();
if( isCtrl==true )
ctrlOff();
return true;
}catch(Exception e)... | 3 |
public void testAvailabe(int H, int V, int A) { // H&V number want be bls of
// indH &indV A = index
if ((this.indexH + H) >= 8 || (this.indexV + V) >= 8
|| (this.indexV + V) < 0 || (this.indexH + H) < 0) {
this.availableCells[A] = null;
} else if (myBoard.bordaCell[this.indexH + H][this.indexV... | 8 |
public boolean isXCollision(int x) {
Point midpoint = getMidPoint(x, y, BOAT_WIDTH, BOAT_HEIGHT, rotation);
int centreX = (int) midpoint.getX();
int centreY = (int) midpoint.getY();
//Color c = new Color(map.grass.getRGB(centreX, centreY));
if (centreX > 150 && centreX < 1050 && centreY > 0 && centreY < ma... | 7 |
private Object getValueOfProperty(Object o, Method method, Field field) {
// read!
Object value = null;
try {
method.setAccessible(true);
value = method.invoke(o, new Object[] {});
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
... | 7 |
public String getTypeString(Type type) {
if (type instanceof ArrayType)
return getTypeString(((ArrayType) type).getElementType()) + "[]";
else if (type instanceof ClassInterfacesType) {
ClassInfo clazz = ((ClassInterfacesType) type).getClassInfo();
return getClassString(clazz, Scope.CLASSNAME);
} else if... | 3 |
public FenetreBuffersTailles(){
int jjj=0;
System.out.println("tableauxxx"+ tableauxx.size());
//tableauxx.clear();
System.out.println("tableauxxxdddd"+ FenetreBuffersNumeros.getTableauTailles().size());
srids.clear();
System.out.println("srids"+ FenetreBuffersNumeros.getSrids().size());
System.... | 9 |
public static void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
doubl... | 4 |
private void assignActionsToButtons() {
glGlun.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
updateButtonStates();
}
public void removeUpdate(DocumentEvent e) {
updateButtonStates();
}
... | 5 |
private void keepGettingFeatures(int count) {
// If we're done, don't do anything else.
if (count >= level) {
return;
}
double data[];
int width = subImage.length;
int height = subImage[0].length;
// We're doing the same thing as above, but we're not working with a Raster anymore.
double[][] firstPha... | 9 |
@Test
public void testAIWhatFinishLineWith2EnemyMarkInVosxodyawDiagonal() {
Field field = new Field();
RulesOfGameAndLogic rog = new RulesOfGameAndLogic(field);
field.eraseField();
int rand = (int)(Math.random()*2);
int randINotSetCell = (int)(Math.random()*2);
for (... | 8 |
public static String formatNumber(int start) {
DecimalFormat nf = new DecimalFormat("0.0");
double i = start;
if(i >= 1000000) {
return nf.format((i / 1000000)) + "m";
}
if(i >= 1000) {
return nf.format((i / 1000)) + "k";
}
return ""+start;
} | 2 |
public Tour Mate(Tour t){
ArrayList<City> temp = t.tour;
Integer random = (int) (Math.random()*tour.size());
ArrayList<City> child = new ArrayList<City>(tour.subList(0, random));
for(int i=0;i<child.size();i++){
temp.remove(child.get(i));
}
for(City c:temp){
if(c!=null){
child.add(c);
}
}
... | 5 |
public OperationExpression simplify() {
if (((PrimitiveOperator) op).isComplexIDOfLeft()) {
return new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP),
left);
}
if (((PrimitiveOperator) op).isComplexNotOfLeft()) {
return new UnaryOpExpression(new PrimitiveOp... | 6 |
public ArrayList<String> load(String csvFile) {
BufferedReader br = null;
String line = "";
String csvSplitBy = ",";
data = new ArrayList<String>();
String[] tempArray=null;
try
{
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null)
{
tempArray=line.split(cs... | 6 |
public void renderHealth(int x, int y, int xOffset, int yOffset)
{
x <<= 5;
y <<= 5;
x = (int) (((x + xOffset) - camera.getXOffset()));
y = (int) (((y + yOffset) - camera.getYOffset()));
x += 2;
y += 36;
int barWidth = 29;
int barHeight = 4;
int[] bg = new int[barWidth * barHeight];
// Render the... | 7 |
protected void calculateGlobalBest() {
int best = 0;
if(maximum){
for(int i = 0; i < fitness.size(); i++){
if(fitness.get(i) > fitness.get(best)){
best = i;
}
}
}else{
for(int i = 0; i < fitness.size(); i++){
if(fitness.get(i) < fitness.get(best)){
best = i;
}
}
}
globalB... | 5 |
public void hbasePreDispatch(List<Row> rows, List<StoreLoader<?>> rowLoaders, List<Increment> increments,
List<StoreLoader<?>> incrementLoaders, byte[] familyName) {
Put entityPutRow = new Put(getId().getKey().getBytes());
for (Map.Entry<Key, Data> column : getColumns().entrySet()) {
entityPutRow.ad... | 3 |
public static void main(String[] args) {
Ex1 e1 = new Ex1();
System.out.println(e1);
} | 0 |
public String addMessage() throws Exception {
System.out.println("userName is " + userName);
Connection conn = null;
int addCount = 0;
Statement stmt = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url, user, psw);
if (!conn.isClosed())
System.out.println(... | 3 |
public void addBorder()
{
for (int i = 0; i < width(); i++)
{
for (int j = 0; j < height(); j++)
{
if (i == 0 || j == 0 || i == width() - 1 || j == height() - 1)
maze[i][j] = 1;
}
}
maze[1][0] = 0;
maze[width() - 2][height() - 1] = 0;
} | 6 |
public Connection getConnection()
{
//
System.out.println("-------- Mysql Connection Testing ------");
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is MySQL Driver?");
e.printStackTrace();
... | 3 |
public static int Str2Int(String str)
{
if (str == null || "".equals(str))
return 0;
return Integer.parseInt(str);
} | 2 |
public static double[][] doubleSelectionSort(double[][] aa){
int index = 0;
int lastIndex = -1;
int n = aa[0].length;
double holdx = 0.0D;
double holdy = 0.0D;
double[][] bb = new double[2][n];
for(int i=0; i<n; i++){
bb... | 4 |
public static Status getEnum(String value) {
if (value == null) {
throw new IllegalArgumentException();
}
for (Status v : values()) {
if (value.equalsIgnoreCase(v.getValue())) {
return v;
}
}
throw new IllegalArgumentException();
} | 3 |
public void aumentarTiempoEnEspera() {
if (numProcesos != 0) {
for (int i = menorPrioridadNoVacia; i < listas.length; i++) {
for (int j = 0; j < listas[i].size(); j++) {
listas[i].get(j).aumentarTiempoEnEspera();
}
}
}
} | 3 |
public static String getTypeValById(Integer id) {
switch (id) {
case TYPE_DATE:
return "dateval";
case TYPE_FLOAT:
return "floatval";
case TYPE_INT:
return "intval";
case TYPE_LIST:
return "listval";
... | 6 |
public static void alteraContato(String nome, String novonome, String novoendereco, String novotel) throws FileNotFoundException, IOException {
StringBuilder sb = new StringBuilder();
InputStream is = new FileInputStream("Contatos.txt");
PrintStream qs = new PrintStream("Auxiliar.txt");
... | 4 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// CHANGE: The EJB is instantiated automatically
// CourseModel model = CourseModelImpl.getInstance();
String path = request.getServletPath();
if (path.... | 4 |
public KeyInfoType getEncryptionKey() {
return encryptionKey;
} | 0 |
public void Jouer() {
afficherInfosDebutTour();
Joueur j;
for(IndexJoueurCourant = 0; IndexJoueurCourant < this.joueurs.size(); IndexJoueurCourant++){
int nbdoble=1;
j = this.joueurs.get(IndexJoueurCourant);
j.avancer();
... | 6 |
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.