text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void updateTask()
{
double var1 = 100.0D;
double var3 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ);
boolean var5 = this.entityHost.getEntitySenses().canSee(this.attackTarget);
if (var5)
{
... | 6 |
private void ComputeLCPMatrix(Vector<Contact> contacts, Matrixd A) {
for (int i = 0; i < contacts.size(); ++i)
{
Contact ci = contacts.get(i);
Vector3d tmp = new Vector3d(ci.contactPoint);
tmp.Substract(ci.body[0].position);
Vector3d rANi = tmp.CrossProduct(ci.contactNormal);
tmp = new Vec... | 6 |
@Override
public void updateUser(User user) {
User old = userDao.findById(user.getId());
if(old==null)
return ;
//cannot update so return null
old.setName(user.getName());
old.setSurname(user.getSurname());
userDao.saveOrUpdate(old);
} | 1 |
public boolean hasSideEffects(Expression expr) {
if (expr instanceof MatchableOperator
&& expr.containsConflictingLoad((MatchableOperator) expr))
return true;
for (int i = 0; i < subExpressions.length; i++) {
if (subExpressions[i].hasSideEffects(expr))
return true;
}
return false;
} | 4 |
public static StateObject getStateObject(int objectX, int objectY, int objectHeight, int objectId)
{
for (StateObject so : stateChanges)
{
if(so == null)
continue;
if(so.getHeight() != objectHeight)
continue;
if(so.getStatedObject() == objectId && so.getX() == objectX && so.getY() == objectY)
... | 6 |
private double[][] getHelperArray() {
double[][] helperArray = new double[combinedOutputs[0].length][combinedOutputs.length * (input[0].length + 1)];
int parameterCnt = input[0].length + 1;
for(int i = 0; i < combinedOutputs[0].length; i++) {
for(int j = 0; j < combinedOutputs.length; j++) {
for(int k =... | 4 |
public int romanToInt(String s) {
int res = 0;
for(int i =0; i<s.length();i++)
{
if(i<s.length()-1)
{
String x = s.substring(i, i+2);
switch (x){
case "CM": res += 900;i++; break;
case "CD": res += 400;i++;break;
... | 8 |
String proteinFormat(String protein) {
if (protein.isEmpty()) return "";
// We use uppercase letters
protein = protein.toUpperCase();
// Stop codon is trimmed
int idxLast = protein.length() - 1;
char lastChar = protein.charAt(idxLast);
if ((lastChar == '*') || (lastChar == '?')) protein = protein.substr... | 4 |
public String getSummary() {
LOGGER.log(Level.INFO, "Generating string summary for bag " + this.hashCode());
String output = "";
for (Disc disc : discs) {
output += "\n* -- " + disc.getName();
}
return output;
} | 1 |
public void buySkiPassMenu(Scanner scanner) {
// Delete old card
skiPassCard = null;
System.out.println("Choose ski-pass type from the list:");
System.out.println("1 - LIMITED:"
+ " limited number of passages, valid for 1 year");
System.out.println("2 - HOURL... | 7 |
public void setState(int state) {
this.state=state;
if (state==0) theApp.setStatusLabel("Setup");
else if (state==1) theApp.setStatusLabel("Signal Hunt");
else if (state==2) theApp.setStatusLabel("Msg Hunt");
} | 3 |
final int _readSymbol_(final int symbol) throws IllegalArgumentException {
switch (symbol) {
case '\\':
case '=':
case ';':
case ']':
case '[':
return symbol;
case 't':
return '\t';
case 'r':
return '\r';
case 'n':
return '\n';
}
throw new IllegalArgumentException();
} | 8 |
public CollapseTool(AutomatonPane view, AutomatonDrawer drawer,
FSAToREController controller) {
super(view, drawer);
this.controller = controller;
} | 0 |
public void render(Graphics g)
{
for (int i = 0; i<tiles.length; i++)
{
for (int j = 0; j<tiles[i].length; j++)
{
if (tiles[i][j]!=null)
{
g.drawImage(tiles[i][j].getImage(),
i*tiles[i][j].getWidth()*Game.SCALE,
j*tiles[i][j].getHeight()*Game.SCALE,
16*Game.SCALE, 16*Gam... | 3 |
public static void main(String[] args) {
Minesweeper m = new Minesweeper(2);
Scanner sc = new Scanner(System.in);
int x = 0 , y = 0;
while(true){
System.out.println(m);
// System.out.println(m.testString());
System.out.print("\nX coordinate\t");
x = sc.nextInt();
if(x == -1)
return;
System.... | 3 |
public static Car getInstance(String typeOfCar, RegistrationNumber registrationNumber, int fuelCapacity, int fuelInCar, boolean carRented){
String stringRepresentation = registrationNumber.toString() + fuelCapacity + fuelInCar + carRented;
Car c = CARS.get(stringRepresentation);
if (c != null) return c;
if (... | 2 |
public final static BruteParams<?> valueOf(final String s) {
for (final BruteParams<?> value : BruteParams.values) {
if (value.s.equalsIgnoreCase(s)) {
return value;
}
}
return null;
} | 4 |
private Singleton(){
// Optional Code
} | 0 |
@Test
public void testNoTestLinkAnnotationSuccess() {
assertTrue(true);
} | 0 |
@Override
public void keyReleased(KeyEvent ke) {
switch (ke.getKeyCode()) {
case KeyEvent.VK_F:
MainClass.getLevelManager().getPlayer().processFRelease();
break;
case KeyEvent.VK_D:
MainClass.getLevelManager().getPlayer().processDRelease();
break;
case KeyEvent.VK_LEFT:
... | 7 |
protected static Ptg calcDec2Oct( Ptg[] operands )
{
if( operands.length < 1 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "DEC2OCT" );
long dec = PtgCalculator.getLongValue( operands[0] );
int places = 0;
if( operands.length > 1 )
{
places = operands[1].getIntVal();
}
... | 8 |
public void addButtons() {
if (save == null) {
save = new JButton("Save");
save.addActionListener(this);
}
if (cancel == null) {
cancel = new JButton("Cancel");
cancel.addActionListener(this);
}
if (!rebuilding) {
buttonPanel = new JPanel();
} else {
frame.remove(buttonPanel);
}
if (!r... | 4 |
public String goToAdminProductsList() {
this.retrieveAllProducts();
return "adminProductsList";
} | 0 |
public void load()throws IOException{
props.load(new FileInputStream(file));
} | 0 |
public List<List<Integer>> levelOrderBottom(TreeNode root) {
List<List<Integer>> result = new ArrayList<>();
Stack<List<Integer>> stack = new Stack<>();
if(root == null) return result;
Queue<TreeNode> q1 = new LinkedList<>();
Queue<TreeNode> q2 = new LinkedList<>();
q1.o... | 9 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
final boolean undead=CMLib.flags().isUndead(target);
if(!super.invoke(mob,commands,givenTarget,auto,a... | 8 |
public static BV4502 getInstance(I2CInterface device, char channel) {
BV4502.device = device;
switch (channel) {
case 'A' :
if (channel_A==null) channel_A=new BV4502('A');
return channel_A;
case 'B' :
if (channel_B==null) channel_B=new BV4502('B');
return channel_B;
... | 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 feel.
* For details see http://down... | 6 |
public JSONObject increment(String key) throws JSONException {
Object value = opt(key);
if (value == null) {
put(key, 1);
} else if (value instanceof Integer) {
put(key, ((Integer)value).intValue() + 1);
} else if (value instanceof Long) {
put(key, ((L... | 5 |
public static boolean checkHashes(String... fileName) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT `wadname`,`md5` FROM `").append(mysql_db).append("`.`wads` WHERE `wadname` IN (");
int i = 0;
for (; i < fileName.length; i++) {
if (i == fileName.length - 1)
sb.append("?");
else
sb.a... | 7 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
private static void SwapStudents() {
int indexOfStu1 = -9;
int indexOfStu2 = -9;
String lName = new String();
String fName = new String();
boolean okStu1 = false;
boolean okStu2 = false;
boolean okToSwap = false;
int studentOn = 1;
while (!(okToSwap)) {
fName = JOptionPane
.showInputDialog... | 6 |
public static ArrayList<Fine> getAllUnpaidFines(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Fine> fineList = new ArrayList<Fine>(... | 5 |
public CalculationPeriodFrequency readCalculationPeriodFrequency(XMLStreamReader2 streamReader) throws XMLStreamException {
Integer periodMultiplier = null;
PeriodEnum period = null;
RollConventionEnum rollConvention = null;
int startingDepth = streamReader.getDepth();
while(streamReader.hasNext()) ... | 8 |
@Override
public Command planNextMove(Info info) {
if(info.getEnemies().isEmpty()==false)
{
int e_x = info.getEnemies().get(0).getX();
int e_y = info.getEnemies().get(0).getY();
int pomx,pomy,pomx1,pomy1;
int pos =0;
for(int i=1;i<info.getEnemies().size();i++... | 9 |
public ArrayList<Plane> SearchPlanesAvailable(Date d){
ArrayList<Plane> foundPlanes = new ArrayList<Plane>();
for(Plane p : planes.values()){
boolean dontAdd = false;
for (Flight f : flights.values()) {
if (d.getYear() == f.getDate().getYear() && d.getMonth()... | 7 |
@Override
public void mousePressed(MouseEvent me) {
this.requestFocus();
int x = me.getX() / scale;
int y = me.getY() / scale;
tp.setMouseClick(new Vector3f(x,y,0));
Color c = null;
if(SwingUtilities.isRightMouseButton(me)) {
c = bg;
} else if(SwingUtilities.isLeftMouseButton(me)) {
c = fg... | 7 |
public void actionPerformed(ActionEvent e) {
performAction((Component)e.getSource());
} | 0 |
private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... | 1 |
public void summary2(String label, Map<? extends Object, Stats1D> data, Integer norm, boolean average, FullResult reference)
throws Exception
{
if ( data == null ) return;
boolean allInt = true;
Object[] keys = new Object[data.size()];
int i = 0, sum = 0;
for(Object key : data.... | 9 |
public void actualizarSensores() {
if ((int) robot1.getPuntoActual().getY() - 1 < 0)
robot1.setSensorArriba(false);
else if (DibujoEntorno[(int) robot1.getPuntoActual().getX()][(int) robot1
.getPuntoActual().getY() - 1] == 1)
robot1.setSensorArriba(false);
else
robot1.setSensorArriba(true);
if ((in... | 8 |
public static void main(String[] args) {
if(args == null || args.length < 2){
printHelp();
return;
}
new Transfer().mysql2mongo(args[0],args[1]);
} | 2 |
private void getNumCon() {
//Maintenance debug method, for getting all number of alive connections and connection pools - use to debug current state of the pool.
try {
System.out.println("Number of Connections: " + cpds.getNumConnections());
System.out.println("Number of Idle Con... | 1 |
public void performClick() {
switch (cellType) {
case "F":
setColor(Colors.RED_LIGHT);
break;
case "T":
setColor(Colors.BLUE);
break;
case "0/0":
setColor(Colors.GREEN_LIGHT);
brea... | 4 |
public static Class decodeSolutionType(String encodedQuestion) throws DecodeException, ClassNotFoundException {
Class res;
int i=0;
int beginning = i;
while (encodedQuestion.charAt(i) != '>') {
i++;
}
String type = encodedQuestion.substring(beginning, i);
... | 5 |
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Block block = event.getClickedBlock();
if (block.getType() != Material.CHEST) {
... | 7 |
public SortedSet<TVC> getConnectionsSortedUp() {
return connectionsSortedUp;
} | 0 |
@Override
public void update() {
if (Mouse.getX() > getX() && Mouse.getX() < getX() + getWidth()) {
int mousey = Display.getHeight() - Mouse.getY();
if (mousey > getY() && mousey < getY() + getHeight()) {
if (Mouse.isButtonDown(0)) {
if (!held) {
... | 7 |
public void setup(Map attributes) {
// do we have a SecureRandom, or should we use our own?
rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);
// are we given a set of Diffie-Hellman generation parameters or we shall
// use our own?
DHGenParameterSpec params =
(DHGenPa... | 8 |
public void dump(int x, int y, boolean fore){
try{
if(tiles[x][y] != null){
if(fore){
if(tiles[x][y].foreground != null){
tiles[x][y].foreground.dump();
tiles[x][y].foreground = null;
}
} else {
if(tiles[x][y].background != null){
tiles[x][y].background.dump();
tiles[x][y].ba... | 5 |
public void testWithField2() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
private static Integer randomPort() {
int retries = RANDOM_PORT_RETRIES;
Random random = new Random();
while (retries-- > 0) {
ServerSocket socket = null;
try {
Integer port = random.nextInt(50000) + 10000;
LOGGER.debug("Trying random port: " + port);
socket = new ServerSocket(port);
return ... | 5 |
private static String executeGetCommand(DataBaseManager dbManager, Command command) {
List<String> args = command.getArgs();
String tableName = args.get(0);
String key = args.get(1);
String msg = "";
try {
if ("*".equals(key)) {
Map<String, Row> resul... | 4 |
public static String implode (List strings, String separator) {
StringBuilder sb = new StringBuilder();
Iterator ite = strings.iterator();
while(ite.hasNext()) {
sb.append(ite.next().toString());
if(ite.hasNext())
sb.append(separator);
}
... | 2 |
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>();
boolean[] visited = new boolean[n+1];
for(int i=0;i<=n;i++){
g.add(new ArrayList<Integer>());
visited[i]=fa... | 3 |
private String calculatePostfix(QueueInterface<T> postfix) throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException
{
StackInterface<T> operandStack = new DynamicArray<T>();
DequeInterface<T> exprDeque = new DynamicArray<T>();
String result = "";
whil... | 5 |
private static void setOpaque(JComponent jc, boolean opaque) {
if (jc instanceof JTextField) {
return;
}
jc.setOpaque(false);
if (jc instanceof JSpinner) {
return;
}
for (int a = 0; a < jc.getComponentCount(); a++) {
JComponent child ... | 3 |
public static Company[] getCompanies() {
ArrayList<Company> companies = new ArrayList<Company>();
try {
Statement s1 = conn.createStatement();
ResultSet rs = s1
.executeQuery("Exec getCompanies");
if (rs != null) {
while (rs.next()) {
String name = rs.getString("name");
String hq = ... | 3 |
public void FormEdit(CaseList caselist, ContactList contactlist, boolean createRow)
{
JPanel panel2 = new JPanel(new GridLayout(0,2));
panel2.setPreferredSize(new Dimension(400,200));
panel2.add(new JLabel("Case Add Form"));
panel2.add(new JLabel (""));
JTextField cf0 = new JTextField(this.getCaseNumber())... | 8 |
@MethodInformation(author="Alex", date="09.12.2012", description="Gives back a double that describes the minimum number of swords to plowshares of all DieselTraktor")
protected double minSwordsDiesel() {
MyIterator it = (MyIterator) traktoren.iterator();
double min = 0;
while(it.hasNext()) {
Traktor obj =... | 5 |
public void processEvent(Event event)
{
if (event.getType() != Event.OMM_ITEM_EVENT)
System.out.println("Received unhandled event: " + event);
OMMItemEvent ommItemEvent = (OMMItemEvent)event;
Handle itemHandle = event.getHandle();
String itemName = _handleMap.get(itemHan... | 7 |
@Override
public void put(String key, Value value) {
char[] array = key.toCharArray();
Node node = this.root;
for (char ch : array) {
int childIndex = this.keyMap.get(ch);
if (node.children[childIndex] == null) {
node.children[childIndex] = new Node(... | 2 |
public static Handshake parse(ByteBuffer buffer)
throws ParseException, UnsupportedEncodingException {
if (buffer.remaining() < BASE_HANDSHAKE_LENGTH + 20) {
throw new ParseException("Incorrect handshake message length.", 0);
}
int pstrlen = new Byte(buffer.get()).intValue();
byte[] pstr = new byte[p... | 4 |
private void shiftLeafAside(int fromIndex, int destIndex, Array<E> newArray, int level) {
if (Math.max(fromIndex, destIndex) > array.getSize()) {
return;
}
int sign = (fromIndex < destIndex) ? 1 : -1;
newArray.setElement(fromIndex + sign * level, array.getElement(fromIndex... | 2 |
public final int getListeningPort() {
return myServerSocket == null ? -1 : myServerSocket.getLocalPort();
} | 1 |
@Override
public boolean activate() {
return (!Bank.isOpen()
&& (
!Inventory.contains(Settings.bar.getFirstId())
|| !Inventory.isFull()
)
&& (
Constants.FALADOR_BANK_AREA.contains(Players.getLocal())
|| Constants.EDGEVILLE_BANK_AREA.contains(Players.getLocal())
|| Constants.AL_KHARID_BANK_AREA.... | 7 |
public String largestNumber(int[] nums) {
if (nums.length <= 0) {
return "";
}
if (nums.length == 1) {
return nums[0] + "";
}
List<Num> lres = new LinkedList();
List l = getNums(nums);
bucketSort(l, -1, lres);
StringBuffer res = new StringBuffer();
StringBuffer res2 = null;
if(log)
res2=new... | 9 |
private EventListJsonConverter() {
} | 0 |
private static int[] exclusion(int[] itemIds1, int[] itemIds2) {
int[] exclusion = new int[itemIds1.length < itemIds2.length ? itemIds2.length : itemIds1.length];
int index1 = 0, index2 = 0, indexResult = 0;
while (index1 < itemIds1.length && index2 < itemIds2.length) {
if (itemIds1[index1] < itemIds2[index2])... | 6 |
static Value determineTypedValue(final Token<?> valueToken, final String variableName) {
Validate.notNull(valueToken);
switch (valueToken.getType()) { // NOPMD
case NULL:
return Value.getNil();
case BOOLEAN:
if (((Token<Boolean>) valueToken).getVal... | 7 |
@Override
public JsonElement serialize(Criteria criteria, Type type, JsonSerializationContext jsc) {
JsonObject json = new JsonObject();
json.addProperty("field", criteria.getField().ordinal()+1 ); // increase by 1
try {
String operator = criteria.getOperator().toString(... | 7 |
private void acao132() throws SemanticError {
if (pilhaMetodosAtuais.peek().getTipo() == null)
throw new SemanticError(
"\"Retorne\" só pode ser utilizado em métodos com tipo");
if (!Tipo.isCompativel(pilhaMetodosAtuais.peek().getTipo(), tipoExpressao))
throw new SemanticError(
"Tipo da expressão d... | 2 |
public void toogleMaximized() {
final Screen screen = Screen.getScreensForRectangle(stage.getX(),
stage.getY(), 1, 1).get(0);
if (maximized) {
maximized = false;
if (backupWindowBounds != null) {
stage.setX(backupWindowBounds.getMinX());
stage.setY(backupWindowBounds.getMinY());
stage.setWidth... | 2 |
@Override
public void update(GameContainer gc, int i) throws SlickException
{
if (gc.getInput().isKeyDown(Keyboard.KEY_ESCAPE))
{
gc.exit();
Sound.kill();
System.exit(0);
}
if(gc.getInput().isKeyPressed(Keyboard.KEY_W))
{
cursor.moveUp(1);
}
if(gc.getInput().isKeyPressed(Keyboard.KEY_A))
{... | 5 |
public boolean equals(Inventory other){
if(other == null){
return false;
}
else if(this.getClass() != other.getClass()){
return false;
}
else{
if(this.getSize() != other.getSize()){
return false;
}
for(int counter = 0; counter < this.getSize(); counter++){
if(this.getList().get(counter)... | 5 |
private void breakUpText(Element e, String s) {
String[] parts = s.split(LINEBREAK);
for (int i = 0; i < parts.length; i++) {
String t = parts[i].replaceAll("\\ +", " ").trim();
t = replaceReservedCharMarkers(t); // replace markers
if (!t.isEmpty())
e... | 3 |
public Object clone() {
try {
SimpleSet other = (SimpleSet) super.clone();
other.elementObjects = (Object[]) elementObjects.clone();
return other;
} catch (CloneNotSupportedException ex) {
throw new jode.AssertError("Clone?");
}
} | 1 |
@Override
public void paintComponent(Graphics g) {
try {
if (cases != null) {
for (int i = 0; i < controler.getLargeurTableau(); i++) {
for (int j = 0; j < controler.getHauteurTableau(); j++) {
final String elt = cases[i][j];
if (elt != null && !elt.isEmpty()) {
final File file = new F... | 7 |
public List<List<String>> getImages(String accessToken, String albumName) throws IOException, ServiceException {
if (StringUtil.isEmpty(albumName)) {
return null;
}
PicasawebService picasawebService = new PicasawebService("zigride");
picasawebService.setAuthSubToken(accessTo... | 9 |
public String getName() {
return name;
} | 0 |
public int hashCode() {
return type == null ? 0 : type.hashCode();
} | 1 |
public static Set<Class> listAnnotatedClasses(Class<? extends Annotation> annotation) {
Set<Class> classes = new HashSet<Class>();
try {
Enumeration<URL> e = ClassLoader.getSystemClassLoader().getResources("");
while (e.hasMoreElements()) {
URL url = e.nextElement();
for (String child : Classes.getChi... | 7 |
public String getHealthText() {
double health = getHealth();
if (health > 0.75) {
return "excellently";
} else if (health > 0.50) {
return "well";
} else if (health > 0.25) {
return "decently";
} else {
return "poorly";
}
... | 3 |
public static void massApplySimpleSprite(Environment envi){
synchronized(envi.lock_critter){
Iterator<Critter> iter = envi.getCritters().listIterator();
while(iter.hasNext()){
Critter crit = iter.next();
try {
crit.image = ImageIO.read(new FileInputStream("C:\\Users\\Daniel\\EclipseWorkspace\\E... | 7 |
public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)... | 6 |
public boolean isEligibleNode(DefaultMutableTreeNode node){
/*Eligible if:
- Is leaf and
- Is not repository/my apps (this covers the case when we have no apps) and
- Is not repository/my apps child (this cover second level hierarchy when no apps)
- Is not "by community" child (this covers third level - on... | 7 |
public List<String> getCategories() {
if (categories == null) {
ArrayList<String> list = new ArrayList<>();
Iterator it = this.iterator();
while (it.hasNext()) {
Term term = (Term)it.next();
if (term.getCategory() != null &&
... | 4 |
public RandomPermutation(int nums)
{
repeat = MAX_REPEATS;
random = new Random();
for (int i = 0; i != nums; ++i)
p[i] = i;
} | 1 |
@Override
public boolean pickAndExecuteAnAction() {
// If a new piece of glass has been received, load the workstation and
// process the glass
if (!glassToProcess.isEmpty()) {
MyGlass tempGlass = null;
synchronized (glassToProcess) {
for (MyGlass g : glassToProcess) {
if (g.status == GlassStatus... | 9 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
String reply = "";
Item item = items.get(rowIndex);
switch (columnIndex) {
case 0:
reply = item.getId();
break;
case 1:
reply = item.getName();
break;
case 2:
reply = Integer.toString(item.getOfferAvailability()... | 8 |
public String identifierUtilisateurs() {
// on récupère les données du formulaire
String loginForm = user.getUserLogin();
if (loginForm != null && !loginForm.isEmpty()) {
String passwordForm = user.getUserPassword();
// on interroge le model
User u = ((UserDAOHibernate) userDAO).findUserByLogin(loginFor... | 4 |
@Override
public void execute() {
this.from.removePiece(this.piece);
if (this.to.hasPiece()) {
this.capturedPiece = this.to.getPiece();
this.to.removePiece(this.capturedPiece);
}
this.to.addPiece(this.promotionedPiece);
this.piece.increaseMoveCount();
} | 1 |
public static String reverse(String code) {
char[] codeline = code.toCharArray();
String reversed = "";
for(int i = codeline.length - 1; i >= 0; i--) {
reversed += codeline[i];
}
return reversed;
} | 1 |
public CheckboxMenuItem getAutoSizeCheckBox() {
if (autoSizeCheckBox == null) {
autoSizeCheckBox = new CheckboxMenuItem("Set auto size");
autoSizeCheckBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
int autoSizeCheckBoxId = e.getStateChange();
if (autoSizeCheck... | 2 |
public Author(String fName, String lName, Newspaper newspaper) {
this.firstName = fName;
this.lastName = lName;
this.newspaper = newspaper;
} | 0 |
public synchronized void update(float increment){
currentTime += increment;
if(currentTime > totalDuration){
wrapAnimation();
}
while(currentTime > frameEndTimes[currentFrameIndex]){
currentFrameIndex++;
}
} | 2 |
@SuppressWarnings("unchecked")
public void addQustionToDB() {
String questionStr = getConcatedString((ArrayList<String>) question);
String answerStr = (String) answer;
// add to database
try {
String statement = new String("INSERT INTO " + DBTable
+ " (quizid, position, question, answer, score) VALUE... | 1 |
public CompanyEmployeeRelationship() {
super(null);
relationshipData = new String[2];
relationshiptxt = "fieldPlacement.txt";
model = new RelationshipTableModel();
fieldTable = new JTable(model);
fieldTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
sorter = new TableRowSorter<Relation... | 3 |
private void createUser() {
panelUserAdd = new JPanel();
panelUserAdd.setBounds(10, 32, 614, 313);
getContentPane().add(panelUserAdd);
panelUserAdd.setLayout(null);
JLabel lblUsername = new JLabel("Username:");
lblUsername.setBounds(10, 11, 77, 14);
panelUserAdd.add(lblUsername);
JLabel lblPassword = ... | 2 |
private boolean saveWorkspace(File saveFile){
WorkspaceData saveData = new WorkspaceData(Main.getStructureBase(),Main.getFileBase(),listDataOut);
try{
FileOutputStream outputStream = new FileOutputStream(saveFile);
ObjectOutputStream objectOutputStream = new ObjectOutputStream(ou... | 1 |
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.