text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void insertMoney(double amountInEuros) {
if (amountInEuros < 0)
throw new IllegalArgumentException("ERR00034512b");
totalAmountInEuros += amountInEuros;
} | 1 |
public static <T> List<T> inorderTraversal(BinaryTree<T> root) {
if (root == null) {
return null;
}
List<T> list = new ArrayList<T>();
BinaryTree<T> prev = root.getParent();
BinaryTree<T> current = root;
BinaryTree<T> next = null;
while (current != nul... | 9 |
@Override
public void fill(Graphics2D g){
if(Display.player.me(0,1).intersects(phys))Display.player.dead=true;
if(Display.player.me(0,-1).intersects(phys))Display.player.dead=true;
if(Display.player.me(1,0).intersects(phys))Display.player.dead=true;
if(Display.player.me(-1,0).intersects(phys))Display.player.de... | 8 |
public int getId() {
return id;
} | 0 |
public void loadWorld(World uploadWorld) {
this.world = uploadWorld;
} | 0 |
private TypedObject readDSK() throws EncodingException, NotImplementedException
{
// DSK is just a DSA + extra set of flags/objects
TypedObject ret = readDSA();
ret.type = "DSK";
List<Integer> flags = readFlags();
for (int i = 0; i < flags.size(); i++)
readRemaining(flags.get(i), 0);
return ret;
} | 1 |
public String summary() {
String toReturn = "";
int drinkCount, snackCount;
drinkCount = snackCount = 0;
for (Dispenser tempDispenser : this.dispensers) {
if (tempDispenser.getType().equalsIgnoreCase("drink") && !tempDispenser.getDispenserContents().isEmpty()) {
drinkCount++;
} else if (tempDispen... | 5 |
public void mousePressed(MouseEvent e) {
// where is the mouse pressed ?
Point p = e.getPoint();
this.pressedIcon = null; // reset the pressed state
int targetTab = findTabAt(p);
if(targetTab != - 1) {
Icon icon = tabbedPane.getIconAt(targetTab);
if(icon instanceof JTabbedPaneSmartIcon) {
JTabbedP... | 8 |
public int getBox(int r, int c){
if(r >= size || c >= size || r < 0 || c < 0){
System.err.println("Invalid dimentions (" + r + "," + c + ") for size " + size);
System.exit(0);
}
return c/dimension + (r/dimension * dimension);
} | 4 |
public void undo() {
if (prevSpeed == CeilingFan.HIGH) {
ceilingFan.high();
}
if (prevSpeed == CeilingFan.MEDIUM) {
ceilingFan.medium();
}
if (prevSpeed == CeilingFan.LOW) {
ceilingFan.low();
}
if (prevSpeed == CeilingFan.OFF) {... | 4 |
public void send(MidiMessage message, long deltaTime) {
System.out.println("New MIDI message");
Event event = null;
ByteArrayInputStream bais = new ByteArrayInputStream(message.getMessage());
DataInputStream dis = new DataInputStream(bais);
try {
dis.mark(2);
... | 7 |
public void kirjoitaOikeanmuotoinenSyote(){
try {
PrintWriter kirjoitin = new PrintWriter(tiedosto);
kirjoitin.println("opiskelu1 10");
kirjoitin.println("opiskelu2 20");
kirjoitin.close();
} catch (Exception e) {
}
} | 1 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Salario)) {
return false;
}
Salario other = (Salario) object;
if ((this.codsalario == null && other.codsalario ... | 5 |
public static String guessContentType(Extension ext){
switch(ext){
case ttl:
return TranslateEnumToContentType(ContentType.TURTLE);
case rdf:
return TranslateEnumToContentType(ContentType.RDF);
case nt:
return TranslateEnumToContentType(ContentType.NT);
case n3:
return TranslateEnumToCont... | 4 |
@Override
public void windowGainedFocus(WindowEvent event) {
if (event.getWindow() == this) {
WINDOW_LIST.remove(this);
WINDOW_LIST.add(0, this);
for (PaletteWindow window : getWindows(PaletteWindow.class)) {
window.setAppWindow(this);
}
}
super.windowGainedFocus(event);
} | 2 |
public DockLayout getRootLayout() {
DockLayout root = this;
while (root.mParent != null) {
root = root.mParent;
}
return root;
} | 1 |
private void unfilter(byte[] curLine, byte[] prevLine) throws IOException {
switch (curLine[0]) {
case 0: // none
break;
case 1:
unfilterSub(curLine);
break;
case 2:
unfilterUp(curLine, prevLine);
... | 5 |
public QueryOrdersByDateResponse queryOrderByDate(QueryOrdersByDateRequest request)
throws GongmingConnectionException, GongmingApplicationException {
URL path = _getPath(QUERY_ORDERS_BY_DATE);
QueryOrdersByDateResponse response = _GET(path, request, QueryOrdersByDateResponse.class);
if (response.co... | 1 |
public void mouseEntered(MouseEvent e) {
} | 0 |
private void chaseUpdate(Vector3f orientation, float distance){
double time = ((double)Time.getTime())/((double)Time.SECOND);
double timeDecimals = time - (double)((int)time);
if(timeDecimals < 0.25)
material.setTexture(animations.get(0));
else if(timeDecimals < 0.5)
... | 7 |
@Override
//Quick and dirty implementation, needs some hard revision
public AbstractStochasticLotSizingSolution solve(
AbstractStochasticLotSizingProblem problem, boolean[] setupPattern)
throws SolvingInitialisiationException,
ConvolutionNotDefinedException {
//Check inputs
if (problem.getPeriods().le... | 6 |
public static ErrorLogs DAOController(Generator generator,
TransactionSet transactionSet, RuleSet ruleSet) {
System.out.println("Starting DAO Controller");
ErrorLogs errorLogs = new ErrorLogs();
VendorPersistenceController vpc = new VendorPersistenceController();
TransactionPersistenceController tpc = new Tr... | 9 |
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Type)) {
return false;
}
Type t = (Type) o;
if (sort != t.sort) {
return false;
}
if (sort >= ARRAY) {
... | 7 |
private boolean jj_3_25() {
if (jj_scan_token(DOT)) return true;
if (jj_scan_token(ID)) return true;
if (jj_3R_39()) return true;
if (jj_scan_token(LP)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_116()) jj_scanpos = xsp;
if (jj_scan_token(RP)) return true;
if (jj_3R_38()) re... | 7 |
public static String optionsCount(String stock) {
String httpdata = getHtml(yahoobase + "/op?s=" + stock);
if (httpdata.contains(">There is no")
|| httpdata.contains("Check your spelling")
|| httpdata.indexOf("View By Expiration") < 0)
return "0";
try {
httpdata = httpdata.substring(httpdata
.i... | 4 |
public void setLimitCallDuration(int limitCallDurationSeconds) {
for (Setting item : settings) {
if (item instanceof SetLimitCallDurationSetting) {
settings.remove(item);
break;
}
}
SetLimitCallDurationSetting limitCallSetting = new SetLimitCallDurationSetting(
limitCallDurationSeconds);
setti... | 2 |
protected void updateLabeling(double slack) {
for (int w = 0; w < dim; w++) {
if (committedWorkers[w]) {
labelByWorker[w] += slack;
}
}
for (int j = 0; j < dim; j++) {
if (parentWorkerByCommittedJob[j] != -1) {
labelByJob[j] -= slack;
} else {
minSlackValueByJob[j] -= slack;
}
}
} | 4 |
public void addItemToInventory(Item item) {
if(item == null)
throw new NullPointerException("An item can't be null.");
// Checken of item niet in inventory van andere speler reeds voorkomt?
inventory.add(item);
} | 1 |
public void sendMessage(String message) {
try {
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
out.println(message);
} catch (IOException e) {
e.printStackTrace();
System.out.println("Failed at METHOD: SENDMESSAGE");
}
} | 1 |
public ResultPage<Patron> getPatronList(int offset) throws SQLException {
openPatronsDatabase();
PreparedStatement statement = patronsConnection.prepareStatement(
"SELECT * FROM Patrons ORDER BY Name LIMIT 11 OFFSET ?");
statement.setInt(1, offset * 10);
ResultSet resultSet = statement.executeQuery();... | 4 |
public void parsePicToBoard(BufferedImage pic) {
board = new char[20][20];
for (int i = 0; i < 20;i++) {
for (int j = 0; j < 20; j++) {
if (new Color(pic.getRGB(i, j)).equals(Color.GREEN))
board[i][j] = COIN;
else if (new Color(pic.getRGB(... | 5 |
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
for (int i = 0; i < GRID_SIZE; i++ )
{
for ( int j = 0; j < GRID_SIZE; j++)
{
sb.append("[ ");
sb.append( StringUtils.rightPad(getLetterAt(i, j), 3) );
sb.append("]");
}
sb.append(NEWLINE);
}
return sb.toSt... | 2 |
public void createRoom(int roomNumber){
list2.clear();
int[] neighbours = new int[4];
neighbours = roomNeighbour(roomNumber); //neighbours[0] ist oben, neighbours[1] ist rechts, neighbours[2] ist unten,neighbours[3] ist links
for(int i=0; i<4; i++){
if(neighbours[i]!=-1){
int[] tmp = new int[6];
tmp ... | 6 |
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if(player != null && bm.getSlot(player.getName()) != null && event.getInventory() instanceof Player)
bm.setCurrentSlotContents(player.getName(), event.getInventory());
} | 3 |
public void pause_ingress() {
synchronized (ingress_paused) {
ingress_paused = true;
}
} | 0 |
public static Double distanceFromPoint(Point3D A, Point3D B) {
if (A == null || B == null) return 0.0;
if (B == A) return 0.0;
if (!(A instanceof Point3D) || !(B instanceof Point3D)) return 0.0;
if (A.isNull() || B.isNull()) return 0.0;
return Math.sqrt(Math.pow((A.getOriginalX(... | 7 |
public void attack()
{
if(monsterLP <= 0 || lifepoints <= 0)
{
System.out.print("The winner has been chosen");
}
else
{
if(damage > monsterD)
{
int gap = monsterD - damage;
monsterLP = monsterLP + gap;
... | 4 |
public void run() {
long lastTime = System.nanoTime();
long timer = System.currentTimeMillis();
final double ns = 1000000000D / 60D;
double delta = 0;
int frames = 0;
int updates = 0;
requestFocus();
while (running) {
long now = System.nanoTime();
delta += (now - lastTime)/ns;
lastTime = now... | 3 |
public void cancelPiece(Piece p){
if(conState != ConnectionState.connected){
throw new RuntimeException("Can only send requests on 'connected' connections");
}else if(peer_choking){
return ;
}
try {
Iterator<Request> itor =ourRequests.iterator();
while (itor.hasNext()) {
Request r = itor.next();... | 5 |
private boolean curious_fraction(int numerator, int denominator) {
Preconditions.checkArgument(numerator >= 10 && numerator < 100);
Preconditions.checkArgument(denominator >= 10 && denominator < 100);
int first_numerator_digit = numerator / 10;
int second_numerator_digit = numerator % 10... | 9 |
public static Cons idlGetConstructorDefinitions(Stella_Class renamed_Class) {
{ Cons constructordefs = Stella.NIL;
{ Slot slot = null;
Iterator iter000 = renamed_Class.classSlots();
Cons collect000 = null;
while (iter000.nextP()) {
slot = ((Slot)(iter000.value));
... | 7 |
private boolean isGranadeOnMyWay(int grenade_x, int grenade_y, int grenade_dir){
int min_x = Math.abs(grenade_x-x);
int min_y = Math.abs(grenade_y-y);
int enX = grenade_x;
int enY = grenade_y;
int angle;
if(x >= enX && y >= enY){
// KVADRANT 1
... | 8 |
public static boolean isPressed(int i) {
return keyState[i] && !prevKeyState[i] ;
} | 1 |
@Override
public void run(){
while(!super.detener){
try{
if(!this.guerreroColaAtaques.isEmpty())
recibirdaño();
if(this.objectivo.x==0&&this.objectivo.y==0){
... | 6 |
public List<ExperienceType> getExperience() {
if (experience == null) {
experience = new ArrayList<ExperienceType>();
}
return this.experience;
} | 1 |
public DefaultComboBoxModel<String> buildList() {
DefaultComboBoxModel<String> comboBoxModel = new DefaultComboBoxModel<String>();
String line;
try {
BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/items"));
while((line = reader.readLine()) != null) {
... | 3 |
protected String getRequestOption(String key)
{
if (this.options != null && this.options.containsKey(key))
{
String param = this.options.get(key);
if (GoCoin.hasValue(param)) { return param; }
}
//default to return null
return null;
} | 3 |
@Override
public void messageHandler(String messageName, Object messagePayload) {
if (messagePayload != null) {
System.out.println("RCV (model): "+messageName+" | "+messagePayload.toString());
} else {
System.out.println("RCV (model): "+messageName+" | No data sent");
}
MessagePayload payl... | 4 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
ArrayList<Game> games = gm.games;
if (args.length >= 1) {
if (args[0].equalsIgnoreCase("join")) {
if (args.length > 1) {
if (Integer.parseInt(args[1]) < games.size() && Integer.parseInt(args[1])... | 7 |
protected void initializeBoard() {
tiles = new Tile[rows][columns];
int mid = columns / 2;
int y = (((rows - 1) % 4 == 0)? 0 : 1);
int x = 0;
Tile wall = new Tile();
tiles[0][mid] = wall;
tiles[tiles.length - 1][mid] = wall;
for (int i = y; i < rows / 4 + y; i++) {
tiles[i][mid - 2 * i + y] = wall;
... | 8 |
public String getCountry() {
return super.getCountry();
} | 0 |
public static boolean isOpaque(EntityType type) {
boolean b = true;
switch (type) {
case OBJ_TREE:
break;
case OBJ_DOOR_WOOD:
break;
case ENTR_DUNGEON:
b = false;
break;
}
return b;
} | 3 |
@Override
public boolean isNull() {
if (getX() != 0 || getY() != 0 || getZ() != 0)
return false;
return true;
} | 3 |
public RotatingComponent(String imageName, int x, int y, int width, int height, final double angleSpeed) {
this.setBounds(x, y, width, height);
image = Utilities.resizeImage(width, height, imageName);
//this.setSize(image.getWidth(null), image.getHeight(null));
timer = new Timer(20, new ActionListener() {
... | 1 |
public static LinkedList<String> findSignificantWords(Path path, int nbWords, HashFunction func, int k) {
if (2 * k < nbWords)
throw new AssertionError("Too much significant words asked for the given sample size.");
SignificantWordsSample ws = new SignificantWordsArraySample(k, func);
/... | 3 |
@Test
public void testDeleteMiddleNode() throws Exception {
head = new LinkedListNode(1).addNode(new LinkedListNode(2)).addNode(new LinkedListNode(3)).addNode(new LinkedListNode(4)).addNode(new LinkedListNode(5));
LinkedListNode middleNode = new LinkedListNode(6);
head.addNode(middleNode).ad... | 8 |
@Override
public void atacar(){
for(int i = 0; i < ejercito.size(); i++){
int refPosX = ejercito.get(i).refLabel.getLocation().x;
int refPosY = ejercito.get(i).refLabel.getLocation().y;
Point pos = super.refPosToMatrizPos(refPosX, refPosY);
... | 5 |
public FinishedJobRecord(String str) {
StringTokenizer st = new StringTokenizer(str, ":");
int tokNumber = 0;
while (st.hasMoreElements()) {
tokNumber++;
String val = st.nextToken();
// We only get what we need, fields which are not used by
// p... | 9 |
public SerialCtl(String aa, String bb) {
a = "Not transient: " + aa;
b = "Transient: " + bb;
} | 0 |
public void UpdateAtividade(Atividade atividade) throws SQLException, atividadeExistente {
AtividadeDAO atividadeDAO = new AtividadeDAO();
Atividade atividadeExistente = null;
atividadeExistente = atividadeDAO.SelectATividadePorNome(atividade.getNome());
if (atividadeExistente == null ... | 2 |
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 boolean isSenderPlayer() {
if(sender != null && sender instanceof Player) return true;
return false;
} | 2 |
public void searchDescricaoExames() {
facesContext = FacesContext.getCurrentInstance();
renderizarDadosEncontrados = true;
List<DescricaoExames> listDescricaoExames;
if (!descricaoExames.getDes_codigoProcedimento().isEmpty() || !descricaoExames.getDes_nomeexame().isEmpty()) {
try {
listD... | 5 |
public void play(String audioFilePath) {
File audioFile = new File(audioFilePath);
try {
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
AudioFormat format = audioStream.getFormat();
DataLine.Info info = new DataLine.Info(... | 5 |
@Override
public boolean perform(final Context context) {
// Example: /<command> reset[ <Player>]
OfflinePlayer target = Parser.parsePlayer(context, 1);
if (target == null && context.sender instanceof OfflinePlayer) target = (OfflinePlayer) context.sender;
if (target == null) {
... | 5 |
public void set_Visit(MsgParse mp)
throws SQLException {
if (!mp.visit.getPatient_class().isEmpty())
try {
PreparedStatement prepStmt = connection.prepareStatement(
"insert into visit (patient_class, admission_type, location, prior_location, "
... | 2 |
public void start()
{
for (int i = 0; i < level.length; i++)
{
for (int j = 0; j < level[0].length; j++)
{
Stack<GameObject> it = level[i][j].getGameObjects();
for (int k = 0; k < it.size(); k++)
{
GameObj... | 7 |
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (!isDragging()) {
// this should never happen, as the preview handler should be removed after the dragging stopped
DebugLog.getInstance().printLine("Preview handler still registered, even though dragging stopped... | 6 |
@Override
@SuppressWarnings("static-access")
public void run() {
boolean checar = true;
while (checar) {
if (contadorParaEfetuarATrocaDePosissoesNaFila < Integer.parseInt(Principal.tfQuantum.getText())) {
JPanel panel = new JPanel();
for (int i = 0; i < Principal.processosEmExecucao.size(); i++) {
... | 8 |
private void createAlphaPixels(byte pixels[], int i, int j, int drawingAreaPixels[], int l, int i1, int j1, int k1, int l1, int alpha) {
l1 = ((l1 & 0xff00ff) * alpha & 0xff00ff00) + ((l1 & 0xff00) * alpha & 0xff0000) >> 8;
alpha = 256 - alpha;
for (int j2 = -i; j2 < 0; j2++) {
for (int k2 = -i1; k2 < 0; k2++)... | 3 |
public boolean save(Object obj) {
boolean ret = false;
Session session = sessionFactory.openSession();
try {
session.beginTransaction();
int count = 0;
if (obj instanceof Collection<?>) {
List<?> list = (List<?>) obj;
for (Objec... | 7 |
public void createDoors(){
for(int i=0; i<map.size(); i++){
int[] tmp = new int[6];
tmp = getValue(i);
int[] neighbours = new int[4];
neighbours = roomNeighbour(i);
int orientation = 2;//startindex in map fuer tuer oben
for(int x=0; x<4; x++){
if(neighbours[x]!=-1){
int[] tmp2 = new int[6];... | 4 |
@Override
public void applyAllChanges() throws ApplyChangesException {
try {
// Check if we have a valid xml file by attempting to create a xml
// document from it
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder =... | 4 |
int pack_books(Buffer opb) {
opb.write(0x05, 8);
opb.write(_vorbis);
// books
opb.write(books - 1, 8);
for (int i = 0; i < books; i++) {
if (book_param[i].pack(opb) != 0) {
//goto err_out;
return (-1);
}
}
... | 7 |
public static JSONObject getJSONObject(String url) {
try {
String str = "";
Scanner x = new Scanner(new URL(url).openStream());
while (x.hasNextLine()) {
str += x.nextLine() + "\n";
}
return new JSONObject(str);
} catch (JSONException e) {
e.printStackTrace();
} catch (MalformedURLException ... | 5 |
@Override
public int attack(double agility, double luck) {
System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn...");
return 0;
} | 0 |
public boolean register() {
boolean registered = false;
try {
registered = mServerInt.newUser(mUserName, mUserPass, ServerInterface.CLIENT);
} catch(Exception ex) {
if(connect())
return register();
System.out.println("A Login-Error occured: " + ex.getMessage());
return false;
}
return regis... | 2 |
public static void main(String[] args) {
List<String> numbers = new ArrayList<>();
for (int i = 1; i < 10; i++) {
numbers.add("" + i);
}
Set<Integer> products = new HashSet<>();
List<String> pandigitals = permute("", numbers);
for (String pandigital : pandigitals) {
for (int i = pandigital.length()... | 6 |
private void solve(int[][] board, int cx, int cy, int ideal, int workers)
{
FlipPuzzle flip = new FlipPuzzle( cx, cy, board );
Solver<FlipMove> solver = workers <= 1 ? new Solver<FlipMove>() : new ConcurrentSolver<FlipMove>( workers );
solver.setInitialState(flip);
// Depth-First-Search
solver.setBrea... | 2 |
public void rotACW() {
if (!pause) {
plateau.updatePosition(0, -1);
updateObservers();
}
} | 1 |
@Override
public void logicUpdate(GameTime gameTime) {
for (Entity entity : entityList) {
processEntity(entity, gameTime.getElapsedTimeMilli());
}
} | 1 |
private Location findFood()
{
Field field = getField();
List<Location> adjacent = field.adjacentLocations(getLocation());
Iterator<Location> it = adjacent.iterator();
while(it.hasNext()) {
Location where = it.next();
Object animal = field.getObjectAt(where);
... | 7 |
public static void main(String[] args) {
String str = "abc";
Object obj = new Object();
obj=str; // works because String is-a Object, inheritance in java
MyClass<String> myClass1 = new MyClass<String>();
MyClass<Object> myClass2 = new MyClass<Object>();
//myClass2=myClas... | 0 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
StringKey other = (StringKey) obj;
if (m_name == null)
{
if (other.m_name != null)
return false;
}
else
if (!m_name.equals(other... | 6 |
public NodeDLL deletekey(int key)
{
NodeDLL current = first;
while(current.data != key)
{
current = current.next;
}
if (first == null)
{
return null;
}
if(current == first)
{
first = current.next;
}
else
{
current.previous.next = current.next;
}
if(current == last)
{
... | 4 |
private void runParser() {
logger.debug("Start 'runParser'");
Path currentFile = null;
while (true) {
try {
currentFile = pathStorage.get();
try {
File fileForParsing = currentFile.toFile();
logger.debug("Start parsing '{}' file", currentFile);
FileInputStream stream = new FileInputStrea... | 4 |
private void createPreview() {
page = new Page[pg.getNumberOfPages()];
PageFormat pf = pg.getPageFormat(0);
Dimension size = new Dimension((int)pf.getPaper().getWidth(), (int)pf.getPaper().getHeight());
if(pf.getOrientation() != PageFormat.PORTRAIT)
size = new Dimension(size.height, size.width);
for(int i=0... | 3 |
public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... | 8 |
public static ArrayList<Integer> findSubstring(String S, String[] L) {
if (L.length == 0)
return new ArrayList<Integer>();
ArrayList<Integer> rs = new ArrayList<Integer>();
HashMap<String, Integer> hasFound = new HashMap<String, Integer>();
HashMap<String, Integer> needToFin... | 9 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TipoRecurso)) {
return false;
}
TipoRecurso other = (TipoRecurso) object;
if ((this.idTipoRecurso == null && ot... | 5 |
public ExprInfo(final LocalExpr def) {
this.def = def;
vars = new ArrayList[cfg.size()];
for (int i = 0; i < vars.length; i++) {
vars[i] = new ArrayList();
}
phis = new Phi[cfg.size()];
save = false;
pushes = new HashMap();
pops = new HashMap();
defs = new HashMap();
cleanup = n... | 1 |
@Override
public String suggestSimilarWord(String input)
throws NoSimilarWordFoundException {
input = input.toLowerCase();
MyNode node_found = (MyNode) dict.find(input);
String word_found = input;
if (node_found == null) {
word_found = "";
ArrayList<String> similar = new ArrayList<String>();
simila... | 9 |
public void testPropertySetCopyDay() {
LocalDate test = new LocalDate(1972, 6, 9);
LocalDate copy = test.dayOfMonth().setCopy(12);
check(test, 1972, 6, 9);
check(copy, 1972, 6, 12);
try {
test.dayOfMonth().setCopy(31);
fail();
} catch (Ill... | 2 |
public static boolean aSubsumesB(RuleItem a, RuleItem b){
if(!a.consequence().equals(b.consequence()))
return false;
if(a.accuracy() < b.accuracy())
return false;
for(int k = 0; k < ((a.premise()).items()).length;k++){
if((a.premise()).itemAt(k) != (b.premise()).itemAt(k)){
if(((a.premis... | 7 |
public int lengthOfLIS(int[] nums) {
if (nums == null || nums.length == 0) {
return 0;
}
int dp[] = new int[nums.length];
Arrays.fill(dp, 1);
int longest = 1;
for (int i = 1; i < nums.length; i++) {
for (int j = 0; j < i; j++) {
if (nums[j] < nums[i] && dp[j] + 1 > dp[i]) {
dp[i] = d... | 7 |
public EndOfGame(final String score) { //конструктор принимает счет
//если честно, мне уже надоело эту шапку расписывать, поэтому не буду
frame = this;
this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/mainIcon.jpg")));
setTitle("Угадай картинку");
... | 2 |
public List buildRequest() {
List request=new ArrayList<String>();
String params="";
if(this.method==Method.GET) {
String data="";
for(Iterator i=this.getParameters().keySet().iterator();i.hasNext();) {
String key=(String)i.next();
... | 8 |
public static boolean isSubstring(String searchStr, String pattern){
int[] table = new int[pattern.length()];
int pos, cnd;
if (pattern.length()>0){
table[0] = -1;
}
if (pattern.length()>1){
table[1] = 0;
}
pos = 2;
cnd = 0;
while (pos<pattern.length()){
if (pattern.charAt(pos) ==... | 9 |
public void updateText(String newMessage, int newType) {
Image newImage = null;
switch (newType) {
case IMessageProvider.NONE:
if (newMessage == null) {
restoreTitle();
} else {
showTitle(newMessage, null);
}
return;
case IMessageProvider.INFORMATION... | 8 |
public void paint(DrawableItem di, Graphics2D g) {
fillShape(di, g);
drawShape(di, g);
} | 0 |
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.