text stringlengths 14 410k | label int32 0 9 |
|---|---|
void loadProject(File folder) {
if (!folder.exists()) {
return;
}
workCombo.addItem(new FileDisplayer(folder));
File simDir = new File(folder, SIMULATION_DIR);
openChooser.setCurrentDirectory(simDir.exists() ? simDir : folder);
currWork = folder;
enabl... | 2 |
public byte[] getByteArray( String name ){
XAttribute attribute = getAttribute( name );
if( attribute == null )
throw new XException( "no attribute known with name: " + name );
return attribute.getByteArray();
} | 1 |
public void repeat(int dist, int len) throws IOException {
if (dist < 0 || dist >= full)
throw new CorruptedInputException();
int left = Math.min(limit - pos, len);
pendingLen = len - left;
pendingDist = dist;
int back = pos - dist - 1;
if (dist >= pos)
... | 6 |
public Set<String> parse(URL pageUrl, Reader reader, String encoding) throws IOException {
if (pageUrl == null || reader == null) {
throw new IllegalArgumentException("reader an pageUrl shouldn't be null");
}
MyHTMLEditorKit kit = new MyHTMLEditorKit();
HTMLEditorKit.Parser p... | 7 |
public static String longToStringZeroForEmpty(Long timeLong) {
final Long startTime = StringToLong("1970/01/01 09:00:00 000");
if (startTime == timeLong) {
return "";
}
return longToString(timeLong);
} | 1 |
private static void createAndShowGUI() {
JButton crop = new JButton("Crop");
JFrame frame = new JFrame("Crop image");
JButton load = new JButton("Load");
Calendar localCalendar = Calendar.getInstance(TimeZone.getDefault());
JPanel panel = n... | 4 |
private void toAndroid_adbMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toAndroid_adbMenuActionPerformed
try {
adbController.rebootDevice(selectedDevice, RebootTo.ANDROID);
} catch (IOException ex) {
logger.log(Level.ERROR, "An error occurred while reboot... | 1 |
public String getDescription() {
String input = getInputToRead();
if (input.length() == 0)
input = Universe.curProfile.getEmptyString();
String toPop = getStringToPop();
if (toPop.length() == 0)
toPop = Universe.curProfile.getEmptyString();
String toPush = getStringToPush();
if (toPush.length() == 0)
... | 3 |
@Override
public boolean pieceMovement(Point startPosition, Point endPosition) {
Point difference = new Point();
difference.setLocation(endPosition.getX() - startPosition.getX(), endPosition.getY() - startPosition.getY());
if((Math.abs(difference.getX()) == 2 && Math.abs(difference.getY()) == 1) ||
(Math.... | 4 |
public boolean revert() {
if (type instanceof Reaction.A2_B2__2AB) {
Reaction.A2_B2__2AB r = (Reaction.A2_B2__2AB) type;
r.moleFractionA2().setPointer(0);
r.moleFractionB2().setPointer(0);
r.moleFractionAB().setPointer(0);
r.numberOfA2().setPointer(0);
r.numberOfB2().setPointer(0);
r.numberOfAB()... | 7 |
private int getPrecedence() {
int precedence = 0;
//All other symbols are precedence 0
switch (operatorSymbol) {
case '+':
case '-':
precedence = 1; break;
case '*':
case '/':
precedence = 2; break;
case ... | 5 |
public void createIndex() {
Segmenter seg = new Segmenter();
WordsFilter filter = new WordsFilter();
List<CoreLabel> words;
ResultSet resultSet = null;
String query = "select distinct indexid from dblpcitation union select distinct citationid from dblpcitation;";
ResultSet rs = sqLconnection.Query(query);
... | 5 |
@Override
public boolean isValid()
{
boolean isValid = this.no_of_files >=0 && toDownloadFiles != null && maxFileSizes != null && toDownloadFiles.size() == maxFileSizes.size() && toDownloadFiles.size() == this.no_of_files;
if(!isValid)
{
//TODO: cleanup
//Do clean up if required
}
return isValid;
} | 5 |
@Override
public Computer find(long id) {
// TODO Auto-generated method stub
String query = "SELECT * FROM computer WHERE id="+id;
ResultSet results = null;
Connection connect = ConnectionMySql.getInstance();
Computer computer = null;
try (Statement stmt = connect.createStatement()){
results = stmt.e... | 7 |
public String moveCardOntoTopRowFromRow(int boardIndexFrom, int boardIndexTo) {
List<Card> from = topRow.get(boardIndexFrom);
String result = moveCardOntoTopRow(from, boardIndexTo, from.size()-1);
if (result.isEmpty()) {
from.remove(from.size() - 1);
}
return result;
... | 1 |
@Override
protected AFUNIXOutputStream getOutputStream () throws IOException {
if ( !this.connected && !this.bound ) {
throw new IOException("Not connected/not bound");
}
return this.out;
} | 2 |
private void updateHistogram() {
int red, green, blue;
double max_red = FindPeak(img_red);
double max_green = FindPeak(img_green);
double max_blue = FindPeak(img_blue);
double max_alpha = FindPeak(img_alpha);
max_red = Math.pow(max_red, gradient);
max_green = Math.pow(max_green, gradient);
max_blue = M... | 7 |
public String getValue(int place) throws NotExist {
ListElement current = head;
for (int i = 1; i < place; i++) {
current = current.next();
}
return current.getValue();
} | 1 |
public static void count1Number(int n){
int count = 0;
int factor = 1;
int cur = 0;
int high = 0;
int low = 0;
while(n / factor != 0){
low = n - (n / factor ) * factor;
cur = (n / factor) % 10;
high = n / factor / 10 ;
if(cur == 0){
count += (high) * factor;
}
else if(cur == 1){
... | 3 |
public void updateToSlide() {
if(imageFlow != null) {
if(panel.isVisible()){
try{
imageFlow.scrollAndAnimateTo(Engine.getCurrentSlideID() - 1);
}
catch(NullPointerException e){}
catch(IndexOutOfBoundsException e){}
}
else{
try{
imageFlow.setSelectedIndex(Engine.getCurrentSlideID... | 6 |
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 static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int[] charCount = new int[33];
//алфавит
ArrayList<Character> alphabet = new ArrayList<Character>();
for(int i=0;i<32;i++)
{
... | 5 |
public void move() {
if (type.equals("Quade") || type.equals("Hail")) {
x += MISSILE_SPEED;
distance++;
if (distance >= 150) {
visible = false;
} //when quade powers up, this code activates his super energyballs
if (type.equals("Quade"... | 9 |
public static int hg_step4(int step, double[][] cost, int[][] mask, int[] rowCover, int[] colCover, int[] zero_RC)
{
System.out.println("STEP 4");
//What STEP 4 does:
//Find an uncovered zero in cost and prime it (if none go to step 6). Check for star in same row:
//if yes, cover the row and uncover ... | 9 |
public Component getListCellRendererComponent(final JList list,
final Object value, final int index, final boolean isSelected,
final boolean cellHasFocus) {
if (!(value instanceof LogEntry))
return new JLabel();
final LogEntry wlr = (LogEn... | 8 |
@Test
public void containsWorks()
{
boolean test = true;
for (int i = 0; i < 1000; i++)
{
tree.clear();
for (int j = 0; j < 1000; j++) tree.add(j);
int r = (int)(Math.random() * 1000);
if (!tree.contains(r))
{
te... | 3 |
public boolean set( int row, int column, int value ){
boolean flag = (0 <= row && row < DIGITS &&
0 <= column && column < DIGITS &&
0 < value && value <= DIGITS &&
board[row][column] == 0);
if( flag ){
board[row][column]... | 8 |
public void exit(){
int opt = JOptionPane.showConfirmDialog(this, AimConstants.CLOSE_MESSAGE);
if (opt == JOptionPane.OK_CANCEL_OPTION) return;
if (opt == JOptionPane.NO_OPTION) return;
if (opt == JOptionPane.CLOSED_OPTION) return;
if(opt == JOptionPane.YES_OPTION){
// TODO, Save transactions if any ... | 4 |
public void run() {
ultimaEscritura(nombre);
while (s >= 0) {
if (s == 0)
{
cont--;
System.out.println(nombre + " - " + s + " - ultima escritura"
+ IDanterior);
System.out.println("ultima escritura " + nombre + " - " + cont
+ " Threads activos");
}
else {
System.out... | 3 |
private void xmlBuildFloatingNode(NodeList dockables, Rectangle bounds)
throws SAXException {
// @todo not optimal.. we should refactor it oustide this method
Window desktopWindow = SwingUtilities.getWindowAncestor(this);
if (desktopWindow != null) {
Point windowLocation = desktopWindow.getLocation();
b... | 7 |
@Override
public void move(int dx,int dy){
if(x+dx>=Level.SIZE || y+dy>=Level.SIZE || x+dx<=0 || y+dy<=0 || (l.world[x+dx][y+dy] != TileType.AIR && l.world[x+dx][y+dy] != TileType.FIRE && l.world[x+dx][y+dy] != TileType.TORCH)){
l.worldDamage[x+dx][y+dy]-=1;
}else{
x+=dx;
... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Foul other = (Foul) obj;
if (fouler == null) {
if (other.fouler != null)
return false;
} else if (!fouler.equals(other.fouler))
retur... | 9 |
private void calculaTipoPagamento() {
PedidoDao pDao = new PedidoDao();
pDao.abreConnection();
List<Pedido> pedidos = pDao.listaPedidosPorCaixa(caixa.getIdCaixa());
pDao.fechaConnection();
if (pedidos != null && !pedidos.isEmpty()) {
double totalDinheiro = 0;
... | 9 |
public static void main(String[] args) {
int a = 0, b = 1;
System.out.println(a == b); // false
System.out.println(a != b); // true
System.out.println(a < b); // true
System.out.println(a <= b); // true
System.out.println(a >= b); // false
} | 0 |
public float getImageHeight() {
if(texture != null) {
return (float)texture.getImageHeight();
}
else {
System.err.print("RoyalFlush: Texture2D.getImageHeight - No texture has been loaded.\n");
return -1.0f;
}
} | 1 |
public String execute() throws CrashException {
try {
Registry registry = LocateRegistry.getRegistry(destPeer.IPaddr, destPeer.serverPortno);
ServerSideInterface stub = (ServerSideInterface) registry.lookup("ServerSide");
return stub.ElectionSetTurnHolder(this.turnHolder);
} catch (java.rmi.ConnectExceptio... | 4 |
@Override
public String getEmail() {
return super.getEmail();
} | 0 |
public void run()
{
// Applies the running state, and notifies all listeners that the
// service has started.
notifier.proxy().onServiceStart(this);
// While the service is in a runnable state...
while (!stopped)
{
boolean valid = true;
// If event processing is active...
if (activeEvents) ... | 5 |
public void registerResource(Resource r) {
if (!resources.containsKey(r.getId())) {
resources.put(r.getId(), r);
}
} | 1 |
public Worker () {
//initial settings
results = new int[VALUE_ITERATIONS_NUMBER];
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} | 0 |
public void actionPerformed(ActionEvent e) {
String[] args = getArgs(e);
String channel = args[0];
String sender = args[1];
String source = args[2];
String message = args[3];
if (isCommand("agdq", message))
{
if (acebotC... | 3 |
private void copyAnimations() {
standAnim = new Animation[PlayerEntity.STAND_ANIMATIONS.length];
for(int i = 0; i < PlayerEntity.STAND_ANIMATIONS.length; i++)
standAnim[i] = PlayerEntity.STAND_ANIMATIONS[i].copy();
moveAnim = new Animation[PlayerEntity.MOVE_ANIMATIONS.length];
for(int i = 0; i < PlayerEntity... | 3 |
public static GamePhase makeGamePhase(PhaseTag tag, Player playerOne,
Player playerTwo, Engine engine) {
switch (tag) {
case ATTENTION:
return new AttentionGamePhase(playerOne, playerTwo, engine);
case MEDITATE:
return new MeditateGamePhase(playerOne, playerTwo, engine);
case HEARTRATE_H... | 6 |
public boolean mouseWithin(int x, int y) {
//System.out.println(rectAL.size());
for(int i = 0; i < rectAL.size(); i++) {
// the "highness" of y is inversed due to top being considered y = 0
if(x >= rectAL.get(i).getULX() & x <= rectAL.get(i).getURX() & y <= rectAL.get(i).getDLY()... | 2 |
public void draw(Graphics2D g) {
if(highlighted)
g.setColor(Color.RED);
else
g.setColor(Color.BLACK);
if(border)
g.draw(theBox);
g.drawString(text, X, Y+height/2);
} | 2 |
public boolean doTransformations() {
StructuredBlock last = flowBlock.lastModified;
return super.doTransformations()
|| CombineIfGotoExpressions.transform(this, last)
|| CreateIfThenElseOperator.createFunny(this, last);
} | 2 |
static public void startMethod(int methodNumber, Object o, com.github.danfickle.cppToJavaRpcSvrLibrary.Connection conn) throws Exception {
java.lang.Object internal = (java.lang.Object) o;
switch (methodNumber) {
case 1: { /* public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException... | 9 |
static public String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
... | 7 |
public void visit_if_acmpne(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} | 1 |
private void startSocketHandler() {
socketHandler = new Thread() {
@Override
public void run() {
XMLStreamReader parser = connection.getParser();
try {
while(socketHandler != null) {
if(parser.next() != XMLStreamConstants.START_ELEMENT) continue;
socketHandlerLatch = new CountDownLatch... | 8 |
public JSONObject getCityList(String filter, Integer countryCode, Integer regionCode, Integer limit, Integer offset, String orderBy, String direction) {
StringBuilder uriBuilder = new StringBuilder("/api/getCityList?") ;
log.debug("Setting API Token") ;
uriBuilder.append("AUTH_TOKEN="+apiToken) ;
if (filter!=... | 9 |
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
name=(String)jComboBox2.getSelectedItem();
try {
try {
try {
try {
... | 5 |
@Override
public double getCategoryJava2DCoordinate(CategoryAnchor anchor,
int category,
int categoryCount,
Rectangle2D area,
Rectan... | 8 |
private RouteLabel labelReroute(int startNode, int endNode, int maxRisk){
// Initialization
RouteLabel bestRoute = null; // Keeps track of so far best finishing label
ArrayList<RouteLabel> activeLabels = new ArrayList<RouteLabel>(); // Keeps track of all labels
RouteLabel initialLabel = new RouteLabel(startNode... | 8 |
@Override
public boolean equals(final Object obj) {
if (obj == null)
return false;
if (obj == this)
return true;
if (obj.getClass() != getClass())
return false;
PartialCKDoor otherPCKDoor = (PartialCKDoor) obj;
if (new EqualsBuilder()
.append(isValid, otherPCKDoor.isValid)
.append(isDouble, ... | 9 |
public void attacked(int dmg) {
subtractHitpoints(dmg);
if (getHitpoints() <= 0) {
setToDead();
// tower.addKills(1);
}
} | 1 |
public static void main(String[] args) {
long start = System.nanoTime();
int count = 0;
for (int i = 1; i <= 10000; i++) {
BigInteger newNum = BigInteger.valueOf(i);
boolean isLychrel = true;
for (int k = 0; k < 50; k++) {
newNum = reverseAdd(newNum);
if (isPalindromic(newNum)) {
isLychrel =... | 4 |
private void RemoverEscola_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoverEscola_ButtonActionPerformed
try {
String escola = Escola_ComboBox2.getSelectedItem().toString();
a.RemoverEscola(escola);
EscolaSelecionada_Label.setText("nenhuma");
... | 3 |
public byte[] unpack() {
if (compression == 0) {
return buffer;
}
byte[] result = new byte[size];
if (compression == 1) {
try {
DataInputStream stream = new DataInputStream(new BZip2CompressorInputStream(
new ByteArrayInputStream(buffer)));
stream.readFully(result);
stream.close();
} ... | 4 |
void headerOnMouseDoubleClick (Event event) {
if (!isFocusControl ()) setFocus ();
if (columns.length == 0) return;
CTableColumn[] orderedColumns = getOrderedColumns ();
int x = -horizontalOffset;
for (int i = 0; i < orderedColumns.length; i++) {
CTableColumn column = orderedColumns [i];
x += column.width;
i... | 9 |
public UsuarioBean type(UsuarioBean oUsuarioBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
Boolean isAlumno = oMysql.typeUser("alumno", "usuario", "alumno.id_usuario", "alumno.id_usuario", oUsuarioBean.getId());
Boolean isProfesor = oMysql.typ... | 4 |
@Override
public void run() {
ByteBuffer buf = ByteBuffer.allocate(8196);
try {
int bytesRead = channel.read(buf);
while (bytesRead > 0) {
bytesRead = channel.read(buf);
System.out.println(bytesRead);
}
} catch (IOException ... | 3 |
public void method389(boolean flag1, int i, int j, String s, int k)
{
aBoolean1499 = false;
int l = i;
if(s == null)
return;
k -= anInt1497;
for(int i1 = 0; i1 < s.length(); i1++)
if(s.charAt(i1) == '@' && i1 + 4 < s.length() && s.charAt(i1 + 4) == '@')
{
int j1 = getColorByName(s.substring(i1 + 1, i1 + 4... | 9 |
protected static void initFilters(boolean loader, Vector<String> classnames) {
int i;
int n;
String classname;
Class cls;
String[] ext;
String desc;
FileSourcedConverter converter;
ExtensionFileFilter filter;
if (loader)
m_LoaderFileFilters = new Vector... | 7 |
public NexTServer(){
try {
serverSocket = new ServerSocket(port_number);
}
catch (IOException e)
{System.out.println(e);}
while(true){
try {
clientSocket = serverSocket.accept();
for(int i=0; i<=max_clients; i++){
if(t[i]==null)
{
(t[i] = new clientT... | 5 |
public void convertGeodeticToGeocentric(ProjCoordinate p) {
double Longitude = p.x;
double Latitude = p.y;
double Height = p.hasValidZOrdinate() ? p.z : 0; //Z value not always supplied
double X, Y, Z; // output
double Rn; /*... | 8 |
public static int fibonacci (int n) {
if (n == 0)
return 0;
if (n == 1)
return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
} | 2 |
static final int method2253(int i, int i_0_) {
anInt3814++;
int i_1_ = -124 % ((i_0_ - 55) / 63);
int i_2_ = 0;
if (i < 0 || i >= 65536) {
i_2_ += 16;
i >>>= 16;
}
if ((i ^ 0xffffffff) <= -257) {
i >>>= 8;
i_2_ += 8;
}
if (i >= 16) {
i_2_ += 4;
i >>>= 4;
}
if ((i ^ 0xffffffff) <=... | 6 |
public static int getIndex(String type) {
switch (type) {
case "water_turbine":
return WATER;
case "wind_turbine":
return WIND;
case "solar_plant":
return SOLAR;
case "nuclear":
return NUCLEAR;
... | 5 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result
+ ((emagVoucherId == null) ? 0 : emagVoucherId.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prim... | 8 |
public List<Integer> preorderTraversal1(TreeNode root) {
if (root == null) return list;
Stack<TreeNode> st = new Stack<TreeNode>();
Queue<TreeNode> qu = new LinkedList<TreeNode>();
st.add(root);
while(!st.isEmpty())
{
root = st.pop();
qu.add(root);
if (root.right != null) st.push(root.rig... | 5 |
public int ladderLength(String start, String end, HashSet<String> dict) {
if (start == null || end == null) return 0;
if (start.equals(end)) return 1;
dict.remove(start);
dict.add(end);
Queue<String> queue = new LinkedList<String>();
Queue<Integer> levelqueue = new LinkedList<Integer>();... | 6 |
private void prebox(TypeDesc from, TypeDesc to) {
// Wouldn't it be cool if I could walk backwards in the instruction
// list and insert the new-dup pair before the value to box was even
// put on the stack?
switch (from.getTypeCode()) {
default:
break;
case ... | 9 |
private <T> int altezza(AlberoBin<T> a) {
int h1 = 0, h2 = 0;
if (a.sin() != null) h1 = 1 + altezza(a.sin());
if (a.des() != null) h2 = 1 + altezza(a.des());
return h1 > h2 ? h1 : h2;
} | 3 |
private void tastendruckBenachrichtigen(String ergebnis) {
try {
for (Object o : tastaturListener) {
try {
o.getClass().getMethod(TASTE, String.class)
// .invoke(o, "" + ev.getKeyChar());
.invoke(o, "" + ergebnis);
} catch (Exception e1) {
... | 3 |
public static final boolean contentEquals( Object c1, Object c2 ) {
if( c1 == null && c2 == null ) return true;
if( c1 == null || c2 == null ) return false;
if( c1 instanceof byte[] && c2 instanceof byte[] ) {
return equals( (byte[])c1, (byte[])c2 );
}
return c1.equals(c2);
} | 6 |
public void locateEntities(EntitySet set, Point point) {
radarSize.setSize(this.size);
radarSize.width -= insets.left + insets.right;
radarSize.height -= insets.top + insets.bottom;
int x = point.x - insets.left;
int y = point.y - insets.top;
set.clear();
Point point1 = new Point();
int dist2 = Inte... | 9 |
@SuppressWarnings("resource")
public void promptPatientFieldSelection(DataSource ds, int health_care_no) {
while (true) {
Patient patient = ds.getPatient(health_care_no);
if (patient == null) {
System.out.println("Could not find a patient with Health Care No. " + health_care_no);
return;
}
... | 7 |
private void RealizeOsServicosPrincipais () {
int flag = 0;
for (int i = 0; i < numeroGeracoes; i++) {
if ( flag == 1) {
minhaGeracao = new MinhaGeneracao(taxaSelecao, tamanhoPopulacao, mecanismoSelecao, mutacao.getPopulacaoDaPonteControladora());
... | 4 |
public static boolean isPalindrome(int n) {
String numString = Integer.toString(n);
String revString = "";
for (int i = numString.length() - 1; i >= 0; i--) {
revString = revString + numString.charAt(i);
}
if (numString.equals(revString)) {
return true;
}
return false;
} | 2 |
@Override
public void executeAll() {
try {
for(IUsersCommand c : _usersCommandLog) {
c.setExecutor(users);
c.execute();
}
} catch (CommandException e) {
System.err.println("Error: Illegal/Invalid command was stored in UsersCommandLog");
e.printStackTrace();
}
} | 2 |
private void update() {
if (!ball.isMoving()) {
ball.setX(board.getX() + (board.getWidth() - ball.getWidth()) / 2);
} else {
if (ball.getX() <= 0 || ball.getX() >= WIDTH) {
System.out.println("bang!");
ball_vx = - ball_vx;
}
if (ball.getY() <= 0) {
System.out.println("bang!");
ball_vy = ... | 7 |
public static GetSampleImage_Result getSampleImage(Database database, GetSampleImage_Param params) {
Logger.getLogger(API.class.getName()).log(Level.FINE, "Entering API.getSampleImage()");
GetSampleImage_Result result;
try {
ValidateUser_Result vResult = validateUser(databas... | 7 |
@Before
public void setUp() throws Exception {
validadorUsuarios = new ValidadorUsuarios();
} | 0 |
public static double getSimilarDegree(String str1, String str2)
{
//���������ռ�ģ�ͣ�ʹ��mapʵ�֣�����Ϊ���ֵΪ����Ϊ2�����飬����Ŷ�Ӧ�������ַ��еij��ִ���
Map<String, int[]> vectorSpace = new HashMap<String, int[]>();
int[] itemCountArray = null;//Ϊ�˱���Ƶ������ֲ����������Խ�itemCountArray�����ڴ�
//... | 5 |
public String getEWord(){
return eWord;
} | 0 |
public void run(){
DataOutputStream output;
DataInputStream input;
GameManager.gameIsRunning = true;
int[] message = new int[2];
int[] action = new int[2];
try {
output = new DataOutputStream(socket.getOutputStream());
input = new DataInputStream(socket.getInputStream());
GameManager.endRoom... | 3 |
public void paintComponent(Graphics g)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
Point point = new Point(j, i);
if (maze.isOpen(point))
drawBox(j, i, SIDE, openColor, g);
if (maze... | 8 |
private void fireClientConnectEvent(ConnectEvent evt) { //throws Exception {
connected = true;
Object[] listeners = connectEventListenerList.getListenerList();
for (int i=0; i<listeners.length; i+=2) {
if (listeners[i]==ConnectListener.class) {
((ConnectListener)listeners[i+1]).OnConnectEvent(... | 2 |
private static double narrow(final double d)
{
if (d < 0)
{
return d - 0.1;
}
else
{
return d + 0.1;
}
} | 1 |
public StockCUDialog() {
this.setTitle("Stock manager");
this.setModal(true);
this.setResizable(true);
this.setSize(new Dimension(300, 300));
this.setLocationRelativeTo(this.getRootPane());
this.setLayout(new BorderLayout(5, 5));
JPanel pnlMain = new JPanel();
this.add(pnlMain, BorderLayout.CENTER);
... | 1 |
private void solve() {
for (int i = 0; i < vertices.length; i++) {
vertices[i].setDistance(Integer.MIN_VALUE);
vertices[i].setPrevious(null);
}
vertices[0].setDistance(0);
PriorityQueue<Vertex> queue = new PriorityQueue<>(Arrays.asList(vertices));
while (!queue.isEmpty()) {
Vertex<Integer> v = queue.... | 9 |
private void setImageDefault(Attributes attrs) {
// find the value to be set, then set it
if (attrs.getValue(0).equals("starttime"))
imageDef.setStartTime(Integer.valueOf(attrs.getValue(1)));
else if (attrs.getValue(0).equals("endtime"))
imageDef.setEndTime(Integer.valueOf(attrs.getValue(1)));
else if (at... | 4 |
public static void handleTransferFailed(SerializableTransferFailed pack) {
SelectionKey key;
String seller;
if (pack.commandInfo.isEmpty()) {
Server.loggerServer.error("The packet doesn't contain seller's name");
return;
}
seller = pack.commandInfo.get(0);
key = Server.registeredUsersChannels.... | 2 |
public static void floodFill(int r, int c) {
for (int i = 0; i < dir.length; i++)
if (r + dir[i][0] >= 0 && r + dir[i][0] < n + 2
&& c + dir[i][1] >= 0 && c + dir[i][1] < m + 2
&& map[r + dir[i][0]][c + dir[i][1]] != 'X'
&& map[r + dir[i][0]][c + dir[i][1]] != '#') {
map[r + dir[i][0]][c + dir[i... | 7 |
public int func_27297_a(StatCrafting par1StatCrafting, StatCrafting par2StatCrafting)
{
int var3 = par1StatCrafting.getItemID();
int var4 = par2StatCrafting.getItemID();
StatBase var5 = null;
StatBase var6 = null;
if (this.slotStatsBlockGUI.field_27271_e == 2)
{
... | 8 |
public static void main(String[] args) {
final int limit = 10000;
final SieveOfAtkin sieve = new SieveOfAtkin(limit);
final ArrayList<Integer> list = sieve.run();
final HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int p : list) {
map.put(p, ma... | 7 |
@Override
public Loja ListById(int id_loja) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Loja l = new Loja();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID);
pstm.setIn... | 3 |
@BeforeClass
public static void setUpClass() {
} | 0 |
public static String[] readfileTxt(String fileName){
String [] s = new String [0];
String direccion = System.getProperty("user.dir")+"/"+ fileName;
// Try to load the file (archive)
File archive;
FileReader fr = null;
BufferedReader br = null;
try {
// Open the file and create B... | 7 |
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.