text stringlengths 14 410k | label int32 0 9 |
|---|---|
protected void loadInputProperties() {
if (VERBOSE)
System.out.println("Loading '" + getInputFilename() + "'...");
m_InputProperties = new Properties();
try {
File f = new File(getInputFilename());
if (getExplicitPropsFile() && f.exists())
m_InputProperties.load(new FileInputStrea... | 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 g... | 6 |
public void RenderAll(Graphics g) {
for (int i = 0; i < tiles.length; i++) { // cols
for (int j = 0; j < tiles[0].length; j++) { // rows
int xt;
int yt;
if (tiles[i][j].getTileID() != 0) {
xt = tiles[i][j].getTileID() % 16 - 1;
yt = (int) Math.floor(tiles[i][j].getTileID() / 16);
sprit... | 3 |
public static String generateKey(String lockString){
int i = 0;
byte[] lock = null;
byte[] key = null;
lockString = lockString.substring(0,lockString.indexOf(' '));
lockString.trim();
lock = lockString.getBytes();
key = new byte[lock.length];
for(i=1;i<l... | 2 |
public void printMiddle(Node root) {
if (root == null) {
return;
}
System.out.println("Linked list is ");
print(root);
Node hare = null;
Node tortoise = null;
boolean temp = false;
if (size(root) % 2 == 0)
temp = true;
if (temp) {
hare = root.getLink();
tortoise = root;
} else {
ha... | 6 |
static final void method2811(boolean bool) {
anInt6777++;
if ((InterfaceScript.anInt6992 ^ 0xffffffff) > -1) {
InterfaceScript.anInt6992 = 0;
TextureLoader.anInt4609 = -1;
Class48.anInt859 = -1;
}
if (InterfaceScript.anInt6992 > Class75.anInt1259) {
InterfaceScript.anInt6992 = Class75.anInt1259;... | 5 |
public void train(StringWrapperIterator i)
{
Set seenTokens = new HashSet();
while (i.hasNext()) {
BagOfTokens bag = asBagOfTokens(i.nextStringWrapper());
seenTokens.clear();
for (Iterator j=bag.tokenIterator(); j.hasNext(); ) {
totalTokenCount++;
Token tokj = (Token)j.next();
if (!seenTokens... | 6 |
public int getLength() {
return this.length;
} | 0 |
public Unit getOccupyingUnit() {
Unit unit = getFirstUnit();
Player owner = null;
if (getOwningSettlement() != null) {
owner = getOwningSettlement().getOwner();
}
if (owner != null && unit != null && unit.getOwner() != owner
&& owner.getStance(unit.getOwne... | 8 |
public void inject(T csvBean, Map<Field, String> values) throws CsvReadException {
if (csvBean == null || values == null || values.isEmpty())
return;
for (Map.Entry<Field, String> entry : values.entrySet()) {
Field field = entry.getKey();
String content = entry.getValue();
Object value... | 6 |
public BoardPiece getPlayerKing(String playerColor) throws Exception{
for (int i=0; i<boardSquares.length; i++){
for (int j=0; j<boardSquares[i].length; j++){
BoardPiece boardPiece = boardSquares[i][j].getBoardPiece();
if (boardPiece != null){
if (boardPiece.pieceColor.equals(playerColor) && boardP... | 5 |
public void loadAttributes(BufferedReader reader) {
try {
String line;
while((line = reader.readLine()) != null && !line.matches("<END>")) {
this.attributes += line + "\n";
}
if(attributes.endsWith("\n"))
attributes = attributes.substring(0, attributes.length() - 1);
} catch (IOException e) {
... | 4 |
private void closeConnection() {
// remove from the selector.
_skey.cancel();
try {
_sChannel.close();
} catch (IOException ignored) {
ignored = null;
}
} | 1 |
public static boolean isMyPlant(Item I, MOB mob)
{
if((I!=null)
&&(I.rawSecretIdentity().equals(mob.Name()))
&&(I.owner()!=null)
&&(I.owner() instanceof Room))
{
for(final Enumeration<Ability> a=I.effects();a.hasMoreElements();)
{
final Ability A=a.nextElement();
if((A!=null)
&&((A.invoker(... | 9 |
public boolean equals(PERangeList other) {
if(this == other) {
return true;
} else if(getNumPE() != other.getNumPE()) {
return false;
}
PERangeList list = intersection(other);
if(list.getNumPE() == getNumPE() && list.getNumPE() == other.getNumPE()) {
return true;
}
... | 4 |
public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
if (alphaImg1 == null) {
alphaImg1 = GraphicsExample.loadImage(device, GraphicsExample.class, "alpha_img1.png");
alphaImg2 = GraphicsExample.loadImage(device, GraphicsExample.clas... | 7 |
public static int min3(int a, int b, int c) {
if( a > b )
return (( c > b) ? b : c);
else
return (( c > a) ? a : c);
} | 3 |
private void btnGuardarClaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarClaveActionPerformed
String p = JOptionPane.showInputDialog("Introduce la clave a guardar");
if (Obj.principal.claves.get(p) != null) {
int g = JOptionPane.showConfirmDialog(null,
... | 2 |
public void init ()
{
if (initted)
return;
try {
getContentPane ().add ("Center",
new DisplayPanel ());
initted = true;
} catch (IOException e) {
e.printStackTrace ();
throw new RuntimeException (e.getMessage ());
}
} | 2 |
public static void applyGear(Background v, Actor actor) {
int BQ = v.standing ;
for (Service gear : v.gear) {
if (gear instanceof DeviceType) {
actor.gear.equipDevice(Item.withQuality(gear, BQ + Rand.index(3))) ;
}
else if (gear instanceof OutfitType) {
actor.gear.equipOutfit(I... | 4 |
public int[] getLongestCommonSequence(int[] x, int[] y) {
int[][] c = new int[x.length + 1][y.length + 1];
// start from c[1][1], since row 0 and column 0 should all be 0
// if either one string is 0, then LCS is also 0
for (int i = 1; i <= x.length; i++) {
for (int j = 1; j <= y.length; j++) {
// thre... | 4 |
boolean checkValidCode(String code, int maxDigit){
try {
for (char c : code.toCharArray()){
check(c >= '0');
check(c <= '0'+maxDigit);
};
} catch (Exception e) {
return false;
}
return true;
} | 2 |
public static int getCount() {
return addresses.size();
} | 0 |
public static String formatOutput(String str)
{
//处理边界的分隔符
int index = str.length()-1;
int start = str.charAt(0) == split_char ? 1 : 0;
int length = str.charAt(index) == split_char ? index : index + 1;
if(start == 0 || length == index)
{
str = str.substrin... | 5 |
public FileItemList(String workingDirectory) {
super(workingDirectory);
directory = new File(workingDirectory);
if (directory.exists() && directory.isDirectory()) {
items.addAll(Arrays.asList(directory.list(new FilenameFilter() {
@Override
public boole... | 3 |
public String toString() {
return super.toString();
} | 0 |
public StringDataType createStringDataType() {
return new StringDataType();
} | 0 |
public static void greyWriteImage(double[][] data){
BufferedImage image = new BufferedImage(data.length, data[0].length, BufferedImage.TYPE_INT_RGB);
for(int x = 0; x < data.length; x++){
for(int y = 0; y < data[0].length; y++){
if(data[x][y] > 1){
data[x][y] = 1;
}
Color color = new Color((floa... | 4 |
public static ArrayList<String> parseInputFile(String filename) {
ArrayList<String> commands = new ArrayList<String>();
File input = new File(filename);
try {
Scanner scanner = new Scanner(input);
while (scanner.hasNextLine()) {
commands.add(scanner.nextL... | 2 |
private void loadDatabase() {
// Declare a few local variables for later use
ClassLoader currentClassLoader = null;
Field cacheField = null;
boolean cacheValue = true;
try {
// Store the current ClassLoader, so it can be reverted later
currentClassLoader = Thread.currentThread().getContextClassLoader... | 4 |
public void print(){
ListNode<T> currentNode=head;
while(currentNode!=null){
System.out.println(currentNode.getData());
currentNode=currentNode.getNext();
}
} | 1 |
private static String resolveEnvVariables(String path) {
for (String i : env.keySet()) {
String p = i.replace("(", "\\(").replace(")", "\\)");
String r = env.get(i).replace("\\", "\\\\");
path = Pattern.compile("%"+p+"%", Pattern.CASE_INSENSITIVE).matcher(path).replaceAll(r);
}
return path;
} | 1 |
public synchronized List<Product> addPreferencesClient(Client client,
Product product) {
if (client != null && product!=null && listOfAllPreferences.get(client) != null) {//if there is already a list
List<Product> listAux = listOfAllPreferences.get(client);
listAux.add(product);
listOfAllPreferences.p... | 6 |
public void addVariablesWithLambdaProductions(Grammar grammar, Set lambdaSet) {
while (areMoreVariablesWithLambdaProductions(grammar, lambdaSet)) {
String variable = getNewVariableWithLambdaProduction(grammar,
lambdaSet);
addVariableToLambdaSet(variable, lambdaSet);
}
} | 1 |
BetLine(TeamType type, int moneyLine, String strTot) {
if (type.equals(TeamType.HOME)) {
home = getDecC(moneyLine);
away = getAnotherC(home);
} else {
away = getDecC(moneyLine);
home = getAnotherC(away);
}
Pattern p = Pattern.compile("([0-9... | 4 |
public List<String> DBExpiredCharNameSearch(Set<String> skipNames)
{
DBConnection D=null;
String buf=null;
final List<String> expiredPlayers = new ArrayList<String>();
final long now=System.currentTimeMillis();
try
{
D=DB.DBFetch();
final ResultSet R=D.query("SELECT * FROM CMCHAR");
if(R!=null) wh... | 8 |
public void updateElementPosition(Element element, Position newPosition) {
if (element == null || newPosition == null)
throw new IllegalArgumentException("The given parameters are invalid!");
getSquare(getElementPosition(element)).removeElement(element);
getSquare(newPosition).addElement(element);
} | 2 |
@Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(affected!=null)
{
if(affected instanceof Room)
{
final Room R=(Room)affected;
for(int i=0;i<R.numItems();i++)
{
final Item I=R.getItem(i);
if(I!=null... | 8 |
private JMenuBar makeMenus() {
ActionListener listener = new ActionListener() {
// An object that will serve as listener for menu items.
public void actionPerformed(ActionEvent evt) {
// This will be called when the user makes a selection
// from the File menu. ... | 4 |
public void quantizeImage(ImageBean img)
{
int[][] newPix = new int[img.getWidth()][img.getHeight()];
for (int x = img.getWidth(); x-- > 0; )
for (int y = img.getHeight(); y-- > 0; )
newPix[x][y] = img.getPixels()[(y * img.getWidth() + x)];
int[] newColMap = Quantize.quantizeImage(newPix, 254);
for (int... | 8 |
public boolean canPlayCard(Card card) {
return Game.linkedGet().isCardPlayable(card) && (turnPlays < 1 || card.value == Game.linkedGet().getPlayPile().peek().value);
} | 2 |
public ArrayList<ITask> CSVLoad(String fileName) throws IOException {
File csvFile = new File(fileName);
if (!csvFile.exists())
throw new FileNotFoundException("Le fichier n'existe pas");
if (csvFile.isDirectory())
throw new FileNotFoundException("Le chemin designe un repertoire et non un fichier");
... | 5 |
public String toString() {
if (instance == null)
return "new " + type;
else
return instance.toString();
} | 1 |
@POST
@Path("/create/multiple/")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response createNewMultipleAccount(Account[] accounts){
Response.ResponseBuilder builder = null;
try {
for(Account account : accounts){
registry.register(account);
}
... | 2 |
public void insererClef(E clef, double priorite) throws Exercice1Exception {
if (clef == null) {
throw new Exercice1Exception("La clef ne peut être null");
}
if (rechercheClef(clef, SEARCH_TREE) != NIL) { // SEARCH_LIST marche nickel
throw new Exercice1Exception("La clef... | 3 |
@EventHandler
public void punchWool(PlayerInteractEvent event) {
CTFTeam team = null;
TeamPlayer player = null;
for (CTFTeam t: Teams){
for (TeamPlayer p: t.getTeamPlayers()){
if (p.getPlayer().equals(event.getPlayer())){
player = p;
team = t;
}
}
}
if (player == null){
... | 7 |
public boolean isOutsideBounds(Bullet b){
if( b.pointY > 640 || b.pointX > 480 || b.pointY < 0 ){
return true;
}
else return false;
} | 3 |
private DataContainer getFromAllTablesInDB() {
DataContainer allData = new DataContainer();
Set<String> tableNames = balancer.getAllAvailableTableNames();
Map<String, TableDescription> tableDescriptions = balancer.getTablesInDataBaseDescription();
for (String tableName : tableNames) {
... | 2 |
public MainWindow()
{
super("简易词法&语法分析器");
this.setBounds(0, 0, 500, 260);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getContentPane().setLayout(null);
this.setLocationRelativeTo(null);
//初始化控件
buttons.add(btnAnalysisDefault);
buttons.add(btnAnalysisCustom);
b... | 2 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
//GEN-FIRST:event_jButton1ActionPerformed
list = new BreakfastDao();
} catch (SAXException ex) {
Logger.getLogger(addItemToBreakfastMenu.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParserC... | 8 |
private void insertSplayTree(SplayTreeNode currentNode, SplayTreeNode newNode) {
if (currentNode == null) {
this.root = newNode;
} else {
if (newNode.value.compareTo(currentNode.value) < 0) {
if (currentNode.left == null) {
currentNode.left = ... | 5 |
public List<Integer> genNormal(int len, int range) {
List<Integer> list = new ArrayList<>();
for (int idx = 0; idx < len; ++idx)
list.add(RAND_.nextInt(range));
return list;
} | 1 |
public void completeSchedule(Match[] schedule) {
jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS));
jPanel1.add(Box.createRigidArea(new Dimension(0, 6)));
for (Match match : schedule) {
if (!match.searchFor(2771)) {
continue;
}
MatchB... | 2 |
private static void handleDecipherment() {
BigInteger exponent=null, module=null, cypher=null;
try {
exponent = new BigInteger(DeciphermentFrame.getInstance().tfExponent.getText());
if(exponent==null || exponent.compareTo(new BigInteger("0"))<=0) throw new IllegalStateException();
} catch(Exception e) {
... | 9 |
@Override
public void actionPerformed(ActionEvent e) {
//System.out.println("ToggleExpansionAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if ... | 7 |
public static void ex3() throws NumberFormatException, IOException{
System.out.print("Valor del array => ");
int valor=Integer.parseInt(stdin.readLine());
double [] array=new double[valor];
for(int i=0; i<valor; i++){
array[i]=Math.random()*100;
System.out.print(array[i]+"\t");
}
System.out.print("\nColumna d... | 3 |
public int[] plusOne(int[] digits) {
int i = digits.length;
if(i==0){
return digits;
}
boolean inc =true;
for (;i>0;i--){
if (digits[i-1]==9&&inc){
digits[i-1] = 0;
}
else if (inc){
digits[i-1]++;
... | 8 |
public Object getDefault() {
return this.def;
} | 0 |
public void move(){
if (x<0 || x > 1450 || y < 0 || y >1000) {
this.switchDirection();
}
if(direction=='u'){y-=5;}
else if(direction=='d'){y+=5;}
else if(direction=='l'){x-=5;}
else if(direction=='r'){x+=5;}
} | 8 |
private void printStringsFromSetHelper(char[] n, int k, StringBuilder s){
if(s.length() == k){
System.out.println(s.toString());
return;
}
for(int i=0; i<n.length; i++){
StringBuilder builder = new StringBuilder(s);
builder.append(n[i]);
printStringsFromSetHelper(n, k, builder);
}
} | 2 |
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
sc.nextLine();
System.out.println("Lumberjacks:");
while(T>0)
{
T--;
String line = sc.nextLine();
StringTokenizer tokens = new Strin... | 9 |
private static String[] _processAnnotation(String s, StreamTokenizer st)
throws IOException {
s = s.trim();
List<String> tokens = new ArrayList<String>();
Matcher annotationNameMatcher = _ANNOTATION_NAME_REGEXP.matcher(s);
Matcher annotationParametersMatcher =
_ANNOTATION_PARAMETERS_REGEXP.matcher(s);
... | 7 |
public Game(final int typeFirst, String firstName, final int typeSecond, String secondName) {
// TODO: Use enum!!!!
if ((typeFirst >= PLAYER_TYPE_AMOUNT) || (typeSecond >= PLAYER_TYPE_AMOUNT)) {
// return
} else {
pack = new Pack();
switch (typeFirst) {
... | 6 |
public boolean containsValue( Object val ) {
byte[] states = _states;
V[] vals = _values;
// special case null values so that we don't have to
// perform null checks before every call to equals()
if ( null == val ) {
for ( int i = vals.length; i-- > 0; ) {
... | 8 |
@Override
public void setSex(String sex) {
super.setSex(sex);
} | 0 |
@Override
public void drawImage(Function f, MyPanel image, double x, double y) {
Graphics g = image.getGraphics();
Graphics2D g2 = (Graphics2D) g;
g2.translate(150, 150);
g2.scale(x, y);
for (Line l : lines) {
Complex tmp1 = f.evaluate(l.c1);
int p = ... | 2 |
public Integer getLimit(Object[] args) {
if (limitIndex == -1) {
return limit;
}
Object arg = args[limitIndex];
if (arg == null) {
return null;
} else if (arg instanceof Integer) {
return (Integer) arg;
} else {
return null;
}
} | 3 |
public Object next() {
int pos = rand.nextInt(pool.size());
Iterator i = pool.iterator();
while (pos > 0)
i.next();
return (String) i.next();
} | 1 |
@Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if(((msg.sourceMinor()==CMMsg.TYP_QUIT)
||(msg.sourceMinor()==CMMsg.TYP_SHUTDOWN)
||((msg.targetMinor()==CMMsg.TYP_EXPIRE)&&(msg.target()==oldRoom))
||(msg.sourceMinor()==CMMsg.TYP_ROOMRESET))
&&(msg.source().location()!=null)
&&(msg.s... | 9 |
public void remove(String[] command) {
int id = Integer.parseInt(command[0]);
for (int i = 0; i < compuertas.getLength(); i++) {
if (compuertas.get(i).equals(id)) compuertas.remove(i);
}
for (int i = 0; i < salidas.getLength(); i++) {
if (salidas.get(i).equals(id)... | 6 |
public void feed(Object obj) {
synchronized(BalancedPoolStageDriver.this) {
if ( !isInState(RUNNING, STOP_REQUESTED)
|| workers.size() > 1
|| (workers.size() == 1 && workers.peek().runnability == Runnability.RUNNABLE)) {
... | 9 |
public void diceRolled(int roll) {
int ainum = _ais.size();
int rest = _players.size() - ainum;
synchronized(_players) {
for (Hex h : _hexes) {
if (h.getRollNum() == roll) {
for (Vertex vertex : h.getVertices()) {
int p = vertex.getOwner();
if (p != -1) {
_players.get(p).addCard(h.g... | 8 |
private static boolean equalsTypeArray(Class<?>[] a, Class<?>[] o) {
if (a.length != o.length)
return false;
for (int i = 0; i < a.length; i++)
if (!a[i].equals(o[i]) && !a[i].isAssignableFrom(o[i]))
return false;
return true;
} | 6 |
public void generate() {
MapArray = new Tile[size][size];
// System.out.println("passed ");
// assign grass
for (int j = 0; j < size; j++) {
for (int k = 0; k < size; k++) {
MapArray[j][k] = new Tile();
}
}
// System.out.println("passed 1 ");
int TreasureX = (int) (Math.random() * size);
i... | 7 |
@Override
public boolean createWhen() {
return stage.count%15==0 && (6<stage.second() && stage.second()<8);
} | 2 |
public static double atanh(double a) {
boolean negative = false;
if (a < 0) {
negative = true;
a = -a;
}
double absAtanh;
if (a > 0.15) {
absAtanh = 0.5 * FastMath.log((1 + a) / (1 - a));
} else {
final double a2 = a * a;
if (a > 0.087) {
absAtanh = a
* (1 + a2
* (F_1_3 + a... | 6 |
public static int[] getPlayersCountInPositions(int range, L2Character npc, boolean invisible)
{
int frontCount = 0;
int backCount = 0;
int sideCount = 0;
for (L2PcInstance player : npc.getKnownList().getKnownType(L2PcInstance.class))
{
if (player.isDead())
continue;
if (!invisible && player.... | 7 |
public double rate(EnhancedMove move) {
int dropHeight = move.getBoard().dropHeight(move.getPiece(), move.getX());
Point[] pos = move.getPiece().getBody();
Board board = move.getBoard();
int neighbors = 0;
for(int i = 0; i < 4; i ++){
int tarX = pos[i].x + move.getX();
int tarY = pos[1].y + dropHe... | 5 |
static public void main(String args[]) {
double x, y;
OSGB osgb = new OSGB();
if (args.length < 2) {
/*
* Caister Water Tower
*/
x = 651409.903;
y = 313177.271;
} else {
Double d;
d = new Double(args[0]);
x = d.doubleValue();
d = new Double(args[1]);
y = d.doubleValue();
}
... | 3 |
public void fish(Item rod)
{
switch(rod.type)
{
case OLD_ROD:
enemy[0]=Mechanics.randomEncounter(Pokemon.Species.MAGIKARP,20,5,Pokemon.Species.PSYDUCK,20,10,Pokemon.Species.GOLDEEN,20,10,
Pokemon.Species.TENTACOOL,30,5,Pokemon.Species.KRABBY,10,10);
break;
case GOOD_ROD:
enemy[0]=Mechanics.ra... | 3 |
public static List UniteList(List x,List y){
if ((x == null) || (x.size() == 0) || (y == null) || (y.size() == 0)) {
return new ArrayList();
}
if(x.size()>y.size()){
x.retainAll(y);
return x;
}else{
y.retainAll(x);
return y;
}
} | 5 |
public TransformsType createTransformsType() {
return new TransformsType();
} | 0 |
public static List<Oppilas> haeOppilaatByName(String etunimi, String sukunimi) {
Connection c = connect();
if (c == null) return null;
try {
List<Oppilas> oppilaat = new ArrayList<Oppilas>();
PreparedStatement ps = c.prepareStatement("SELECT * FROM oppilas " + "JOIN ryhma ON oppilas.ryhma = ryhma.ryhmaID " ... | 3 |
@Override
public int countZero() {
int count = 0;
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
if (Double.compare(matrix.get(i, j), 0.0) == 0) {
count += 1;
}
}
}
return count;
} | 3 |
private String getCorrectWorldFileName(File folder, String text)
{
int i = 1;
for(int ii = 0;ii<ILLEGAL_WORLD_NAMES.length;ii++)
{
if(text.equalsIgnoreCase(ILLEGAL_WORLD_NAMES[ii]))
text = "_"+text+"_";
}
for(int ii =0;ii<ILLEGAL_WORLD_NAME_COMPONE... | 5 |
private void initForClass(Map<Class<?>, S> context, S system, Class<? extends Object> systemClass) {
for (Field field : systemClass.getDeclaredFields()) {
final Inject inject = field.getAnnotation(Inject.class);
if (inject != null) {
final Object value = context.get(field... | 7 |
private void ejecutarQuery() {
if (txtDB.getText().equals("") || txtQuery.getText().equals("")) {
lblResultado.setText("Falta rellenar alguno de los campos...");
} else {
lblResultado.setText("Enviando consulta...");
lblEstado.setText("Iniciando conexion...");
controlador.enviarDatos(txtDB.getText(), tx... | 2 |
private static byte encodeConnectionId(int connectionId) throws ConnectionIdOutOfRangeException {
if(connectionId != Packet.ANONYMOUS_CONNECTION_ID && (connectionId < Packet.MINIMUM_CONNECTION_ID || connectionId > Packet.MAXIMUM_CONNECTION_ID))
throw new ConnectionIdOutOfRangeException(connectionId);
return (byt... | 4 |
public void read() {
try {
if (this.in == null) {
this.in =
new InputStreamReader(new FileInputStream(this.curFile));
}
while (this.in.ready()) {
this.inputInt = this.in.read();
try {
if (this.textArea == null) {
return;
}
if (!this.running) {
this.textArea.getDoc... | 7 |
private TheaterSeats loadSeatsFromDisk(File name){
FileInputStream fis;
ObjectInputStream ois;
TheaterSeats theaterSeats = null;
try {
fis = new FileInputStream(name);
ois = new ObjectInputStream(fis);
try{
theaterSeats = (TheaterSeats) ois.readObject();
}catch (EOFException e) {
//carry o... | 4 |
public List<Keyword> findKeywords(List<String> kwInput) {
ArrayList<Keyword> res = new ArrayList<Keyword>();
for (String s: kwInput) {
for (Keyword kw: keywordList) {
if (kw.getWord().equals(s)) {
res.add(kw);
}
}
}
return res;
} | 3 |
public static String nowString(){
String dateString = "";
Calendar cal = Calendar.getInstance();
dateString += String.valueOf( cal.get(Calendar.YEAR)) + "年" ;
dateString += String.valueOf( cal.get(Calendar.MONTH) + 1) + "月";
dateString += String.valueOf( cal.get(Calendar.DATE)) +... | 0 |
public void enterCommand(String command, Player player) {
try {
String[] commandString = command.split(" ");
if (SubCommand.isHelpCommand(commandString[0]) || commandString[0].equals("")) {
help(commandString);
} else if (SubCommand.isBackCommand(commandString... | 9 |
public int from() { return v; } | 0 |
public LegendEntry(PlotData2D data, int dataIndex) {
javax.swing.ToolTipManager.sharedInstance().setDismissDelay(5000);
m_plotData = data;
m_dataIndex = dataIndex;
// this.setBackground(Color.black);
/* this.setPreferredSize(new Dimension(0, 20));
this.setMinimumSize(new D... | 7 |
public void move() { //la miscarea automobilului, distanta creste, drumul de misca proportional distantei;
distance += speed;
speed += acceleration;
if (speed > MAX_SPEED) speed = MAX_SPEED;
if (speed <= MIN_SPEED) speed = MIN_SPEED;
pozY += deltaY;
if (pozY <= MAX_TOP)... | 5 |
public static void main(String[] args) {
int i = 0;
outer:
for(; true; ) {
inner:
for(; i<10; i++) {
System.out.println("i = "+i);
if(i == 2) {
System.out.println("continue;");
continue;
}
if(i == 3) {
System.out.println("break;");
i++;
break;
... | 8 |
public byte[] coding(byte[] data) {
int bufLen = data.length + (data.length + 6 ) / 7 ;
ByteBuffer buf = ByteBuffer.allocate(bufLen);
for(int i = 0; i != data.length; i++) {
int right = (i % 7) + 1;
int left = 7 - right;
byte value = (byte)((data[i] & 0xFF) ... | 3 |
@Override
public synchronized Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals(flavors[STRING])) {
return nodeSet.toString();
} else if (flavor.equals(flavors[NODESET])) {
return nodeSet.clone();
} else {
throw new UnsupportedFlavorExce... | 2 |
private void asetaViereiset(Ruutu ruutu, int x, int y) {
int miinat = 0;
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
//tarkistetaan ettei ruutun omaa pommia lasketa
if ((i == 0 && j == 0)) {
//tarkistetaan että ruutu on ke... | 9 |
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.