text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public String showColourOfDay(int Day){
String msg1;
try{
if(Day==1){
msg1 = new String("\nDay : Sanday = Red colour");
return msg1;
}
else if(Day==2){
msg1 = new String("\nDay : Monday = Yellor colour");
return msg1;
}
else if(Day==3){
msg1 = new Stri... | 8 |
public static Service SelectServiceByIdEntreprise(int id) throws SQLException {
String query = null;
Service service = new Service();
ResultSet resultat;
try {
query = "SELECT * from SERVICE where ID_ENTREPRISE=? ";
PreparedStatement pStatement = ConnectionBDD.g... | 2 |
protected static String detailedResponse(int status,String method,String resource) {
String response;
switch(status){
case 400:
response="Your browser sent a request that this server could not understand.";
break;
case 404:
... | 3 |
public void topo() {
java.util.ArrayList<Vertex> s = new java.util.ArrayList<>();
int numOfVertices = vertices.length;
while (numOfVertices > 0) {
int tempNumOfVertices = numOfVertices;
Vertex noSuccessorVertex = noSuccessor();
if (noSuccessorVertex != null) {
for (int i = 0; i < vertices.length; i... | 7 |
public static void buildFrontier(final FlowGraph graph, boolean reverse) {
if (!reverse) {
DominanceFrontier.calcFrontier(graph.source(), graph, reverse);
} else {
DominanceFrontier.calcFrontier(graph.sink(), graph, reverse);
}
} | 1 |
@Override
public void positionnementAleatoire() {
this.difficulte = this._partie.getParametre().getDifficulte();
Iterator iterator = this._partie.getParametre().getBateaux(this._partie.getParametre().getEpoque()).keySet().iterator();
while(iterator.hasNext()) {
... | 8 |
@Override
public RoleSchool deserialize(JsonElement je, Type typeOfT, JsonDeserializationContext jdc) throws JsonParseException {
JsonObject jsonObject = je.getAsJsonObject();
String type = jsonObject.get("roleName").getAsString();
switch(type.toLowerCase()){
case "stude... | 3 |
private Map<Class<?>, Set<Class<?>>> buildDirectOwnedToOwnerdMap() {
Map<Class<?>, Set<Class<?>>> clsToOwnersMap = new HashMap<>();
for (Class<?> ownerCls : ownerToOwnedMap.keySet()) {
Map<String, Class<?>> ownedMap = ownerToOwnedMap.get(ownerCls);
for (Class<?> ownedCls... | 9 |
public void listTranslateRules() {
try {
translateRulesFolder = (Folder) session.getObjectByPath("/TranslateRules");
} catch (CmisObjectNotFoundException e) {
System.out.println("translateRules folder not found, creating one.");
Map<String, String> properties = new H... | 8 |
public void run(){
try{
line = (SourceDataLine)AudioSystem.getLine(info);
line.open(af);
line.start();
int num = 0;
while((ais != null) && ( num = ais.read(buff)) != -1){
{
interf.updateDiagram(buff);
line.write(buff, 0, num);
}
}
line.drain();
}catch (IOException e) {
// ... | 6 |
public boolean addEntity(Entity e) {
for(Entity col : entities) {
if(e.isTouching(col)) {
return false;
}
}
entities.add(e);
return true;
} | 2 |
@Override
public void doAction(String choice) {
switch (choice) {
case "H": // display the help menu
HelpHuntGatherView HelpHuntGatherView = new HelpHuntGatherView();
HelpHuntGatherView.display();
break;
case "T": // hunt
... | 4 |
public void testConstructor_RD_RI5() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Duration dur = new Duration(-1);
try {
new MutableInterval(dur, dt);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public Map<LinkedList<Candidate>, Integer> getDirectedGraph()
{
HashMap<Ranking, Integer> ranks = new HashMap<>();
for (IVoter voter : voters)
{
// make sure the voter has ordered the candidates
if (voter.getCurOrdering() == null)
voter.orderC... | 8 |
public void addSong(Song song, Artist a){
List<String> terms = a.getTerms();
songCount++;
int tempYear = song.getYear();
String yearStr = "";
if(tempYear > 1000 && tempYear < 2050){
yearStr = String.valueOf(tempYear);
}
else{
yearStr = "Non... | 9 |
public boolean SetDecoderProperties(byte[] properties)
{
if (properties.length < 5)
return false;
int val = properties[0] & 0xFF;
int lc = val % 9;
int remainder = val / 9;
int lp = remainder % 5;
int pb = remainder / 5;
int dictionarySize = 0;
for (int i = 0; i < 4; i++)
d... | 3 |
public static List<List<Token>> buildBoard(int size){
List<List<Token>> result = new ArrayList<List<Token>>();
if(size <= colorList.size()){
List<Color> colors = getColors(size);
colors = palettoShuffle(colors, size);
for(int i=0; i< size;i++){
List<Token> newList = new ArrayList<Token>();
for(int... | 3 |
public static Edge createBisectingEdge(Site site0, Site site1) {
double dx, dy, absdx, absdy;
double a, b, c;
dx = site1.get_x() - site0.get_x();
dy = site1.get_y() - site0.get_y();
absdx = dx > 0 ? dx : -dx;
absdy = dy > 0 ? dy : -dy;
c = site0.get_x() * dx + si... | 3 |
private void updateSelection() {
resetSelection();
switch (choiceSelected) {
case 1:
if (saveFileExists) {
regButton = new Sprite(selConButton);
regButton.setX(150);
regButton.setY(250);
} else {
regButton = new Sprite(selButton);
regButton.setX(150);
regButton.setY(400);
... | 6 |
public void setName(String name) {
this.name = name;
} | 0 |
public int[] roomNeighbour(int roomNumber){
int room1,room2,room3,room4;
//room1=oben, room2=rechts, room3=unten, room4=links
if((roomNumber-6)>=0){
room1 = roomNumber-6;
}
else{
room1 = -1;//-1steht fuer eine ungueltige raumnummer
}
if((roomNumber+1)%6!=0){
room2 = roomNumber+1;
}
else{
r... | 4 |
public Object getKey() {
return key;
} | 0 |
public void inline(Object code) {
// First load the class for the inlined code.
Class codeClass = code.getClass();
String className = codeClass.getName().replace('.', '/') + ".class";
ClassLoader loader = codeClass.getClassLoader();
InputStream in;
if (loader == null) {... | 9 |
public BankBillet update(BankBillet billet)
throws CobreGratisBadRequestException,
CobreGratisUnauthorizedException, CobreGratisForbiddenException,
CobreGratisNotFoundException,
CobreGratisServiceUnavailableException,
CobreGratisInternalServerErrorException,
CobreGratisTooManyRequestsException,
Cob... | 9 |
public static boolean validMulticast(String ip) {
if (ip == null || ip.isEmpty()) return false;
ip = ip.trim();
if ((ip.length() < 6) & (ip.length() > 15)) return false;
try {
Pattern pattern = Pattern.compile("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[... | 4 |
@SuppressWarnings("unchecked")
@Override
public void mouseClicked(MouseEvent e) {
JList<String> list = (JList<String>) e.getSource();
if(e.getClickCount() == 2){
int index = list.locationToIndex(e.getPoint());
ListModel<String> dlm = list.getModel(... | 3 |
public void harvest() {
for (ListenerHolder listener : listeners.values()) {
if (listener.getLiveUntil() < admin.calculateTime()) {
cancelListener(listener);
}
}
List<ISemiSpaceTuple> beforeEvict = new ArrayList<ISemiSpaceTuple>();
... | 9 |
private void updateGridletProcessing()
{
// Identify MI share for the duration (from last event time)
double time = GridSim.clock();
double timeSpan = time - lastUpdateTime_;
// if current time is the same or less than the last update time,
// then ignore
if (timeSpa... | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EntityUniqueIdentifier other = (EntityUniqueIdentifier) obj;
if (clazz == null) ... | 9 |
@SuppressWarnings("unchecked")
@Override
public String displayQuestionWithAnswer(int position, Object userAnswer) {
String questionStr = (String) question;
ArrayList<String> answerList = (ArrayList<String>) answer;
String userAnswerStr = (String) userAnswer;
boolean correct = false;
if (getScore(userAnswer)... | 4 |
private Collection<Library> allocateBooksForLibraries(final String book, final int quantity,
final Collection<Library> allLibrariesToBeAllocated) {
final Collection<Library> allocatedLibraries = new HashSet<Library>();
int remaningQty = quantity;
for (Library library : allLibrariesToBeAllocated) {
if (l... | 9 |
public void initialize() {
// For each card
for ( int i = 0; i < ga.getNumberOfCards(); i++ ) {
int availableStock = 0;
int requiredStock = ga.getCardList().get( i ).getNumber();
for ( int j = 0; j < ga.getSellers().length; j++ ) {
this.availableStock[j][i] = ga.getAvailabilityConstraints()[j][i];
... | 5 |
public void loadLocations() {
Connection conn = plugin.getDbCtrl().getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = String.format("SELECT * FROM `%s`",
plugin.getDbCtrl().getTable(Table.LOCATION));
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
w... | 3 |
private static Expr analyzeSeq(C context, ISeq form, String name) throws Exception{
Integer line = (Integer) LINE.deref();
if(RT.meta(form) != null && RT.meta(form).containsKey(RT.LINE_KEY))
line = (Integer) RT.meta(form).valAt(RT.LINE_KEY);
Var.pushThreadBindings(
RT.map(LINE, line));
try
{
Object me = ma... | 9 |
public String getGoTo() {
return goTo;
} | 0 |
public BookingListResult(JSONObject json) throws JSONException {
super(json);
if (json.has("result")) {
JSONArray jsonArray = json.getJSONArray("result");
String packageId = null;
Vector packetItems = null;
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject bookingJson = jsonArray.getJ... | 9 |
public ArrayList<Trajet> rechercheTrajet(String villeDepart,
String villeArrivee,
DateTime dateDepart,
boolean avecConducteur,
boolean avecPlacesLibres){
ArrayList<Trajet> resultat = new ArrayList<Trajet>();
for(Trajet t : listeTrajets){
if(villeDepart.equalsIgnoreCase(t.getVilleDepart()) &&
v... | 6 |
public void addStock(Stock stock) throws StockAlreadyExistsException,
PortfolioFullException {
int countStockSymbol = 0;
// find the symbol's index and count
for (int i = 0; i < portfolioSize; i++) {
if (stocksStatus[i].getSymbol() == stock.getSymbol()) {
countStockSymbol++;
}
}
if (countStockSy... | 4 |
public SpriteSheet(String path){
BufferedImage image = null;
try {
image = ImageIO.read(SpriteSheet.class.getResourceAsStream(path));
} catch (IOException e) {
e.printStackTrace();
}
if(image == null){
return;
}
this.path = path;
this.width = image.getWidth();
this.hei... | 3 |
public void targetActor() {
GameActor t = getTargetedActor();
if(t != null && withinRadius(t)) {
PhysicsComponent tPC = (PhysicsComponent)t.getComponent("PhysicsComponent");
if(tPC != null) {
PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent... | 9 |
public static String removeChar(final char theChar, final String theString) {
final StringBuilder s = new StringBuilder();
for (int i = 0; i < theString.length(); i++) {
final char currentChar = theString.charAt(i);
if (currentChar != theChar) {
s.append(currentCh... | 2 |
private void initFolder() {
// On crée le dossier temporaire contenant les images
String dirName = "img";
File dir = new File(dirName);
if ( !dir.mkdirs() )
JOptionPane.showMessageDialog(this,
"Impossible de créer le dossier temporaire contenant les images... | 3 |
public int compareTo(Point other)
{
return (distance > other.distance+0.01) ? 1 : (distance < other.distance-0.01) ? -1 : 0;
} | 2 |
public float[] analyzeBook(){
PDFTextStripper stripper;
float posMax = 0;
float negMax = 0;
int curPage = 0;
while (curPage <= bookGrain){ //while on page i
try {
stripper = new PDFTextStripper();
stripper.setStartPage(curPage);
stripper.setEndPage(curPage);
i... | 9 |
@Override
public String toString() {
if (isVertical) {
return "[x=" + value + "]";
} else if (isHorizontal) {
return "[y=" + value + "]";
} else {
String b = String.format("%+f", this.b);
return "[y=" + this.k + "*x" + b + "]";
}
} | 2 |
public ListNode merge(ListNode l1, ListNode l2) {
if (l1 == null){
return l2;
}
if (l2 == null){
return l1;
}
ListNode superHead = new ListNode(-1);
ListNode temp = superHead;
while (l1 != null&&l2 != null){
if(l1.val<l2.val){
... | 7 |
@Override
public void act() {
getImage().scale(40, 40);
checkFall();
onTouchMovingBrick();
if (speed / 4 <= 0) speed = 4;
if (Greenfoot.isKeyDown("a")) {
move(-speed / 4, 0);
switchImageLeft();
}
if (Greenfoot.isKeyDown("d")) {
... | 7 |
private static double getIconRatio(BufferedImage originalImage,
BufferedImage icon)
{
double ratio=1;
if (originalImage.getWidth()>icon.getWidth())
{
ratio=(double)(icon.getWidth())/originalImage.getWidth();
}
else
{
ratio=icon.get... | 4 |
public void DeleteDiffFiles(DatabaseAccess JavaDBAccess, String TargetPHPFileSelectedComboBox) {
int TARGET_PHP_FILES_ID = 0;
PreparedStatement ps = null;
Connection conn = null;
try {
if ((conn = JavaDBAccess.setConn()) != null) {
System.out.println("Connec... | 6 |
synchronized Class<?> defineClass(final String binaryName, final ClassNode cn) {
final ClassWriter cw = new ClassWriter(0);
cn.accept(cw);
final byte[] b = cw.toByteArray();
if (dumpClasses) {
final File f = new File(System.getProperty("user.home") + File.separator + "dump" + File.separator
+ binaryName... | 8 |
public boolean isUnit(){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(this.matrix[i][j]!=1.0D)test = false;
}
}
return test;
} | 3 |
public void move()
{
if (path.size()<=1)
path=getLongestPath(getPos());
else
for (int n=path.size()-2;n>=0 && n>path.size()-10 ;n--)
{// path.size()-1 is always taken: the bike is there
if (path.get(n).notFree())
{
... | 6 |
private static boolean isInsideInSameHorizontalSpace(Positioned a, Positioned b)
{
return a.leftBorder() == b.leftBorder() &&
a.rightBorder() == b.rightBorder() &&
(pointInside(a, (b.leftBorder() + b.rightBorder()) / 2, b.topBorder(), true) ||
pointIn... | 3 |
private PreferencesWindow() {
super(PREFERENCES, StdImage.PREFERENCES);
Container content = getContentPane();
mTabPanel = new JTabbedPane();
for (PreferenceCategoryProvider category : CATEGORIES) {
try {
addTab(category.create(this));
} catch (Exception exception) {
Log.error("Trying to load " + c... | 2 |
public void keyPressed(KeyEvent e)
{
int key = e.getKeyCode();
if(vert)
{
if(key == KeyEvent.VK_UP)
{
keyboardInput=true;
if(y<min)
{
y=min;
}
displacement-=32;
}
if(key == KeyEvent.VK_DOWN)
{
keyboardInput=true;
if(y+height>max)
{
y=max-height;
displ... | 7 |
public static void binaryinsertsort(int[] a,int i){
int left = 0,right = i-1;
int temp = a[i];
while (left<=right) {
int middle=(left+right)/2;
if (temp<a[middle]) {
right= middle-1;
}else {
left = middle+1;
}
}
for (int k=i-1;k>=left;k--){
a[k+1] = a[k];
}
a[left] = temp;
} | 3 |
public static <A> Ord<Stream<A>> streamOrd(final Ord<A> oa) {
return ord(s1 -> s2 -> {
if (s1.isEmpty())
return s2.isEmpty() ? Ordering.EQ : Ordering.LT;
else if (s2.isEmpty())
return s1.isEmpty() ? Ordering.EQ : Ordering.GT;
else {
final Ordering c = oa.c... | 5 |
public ArrayList<String> placeDotCom(int comSize) {
// Declare Function Locals
ArrayList<String> alphaCells = new ArrayList<String>();
// String [] alphacoords = new String [comSize]; // ArrayList to Hold AlphaNumeric Coordinates
String temp = null; // Temporary String for concat
int [] coords = new... | 9 |
public void writeToChannel(String text){
try{
bw.write("PRIVMSG "+ channel +" :"+text+"\n");
bw.flush();
}catch(IOException e){
System.out.println("IRC: Failure when trying to write to server: "+e.getMessage());
}
} | 1 |
public static String trimSectionEndBlanks(String text) {
if (isBlank(text)) {
return text;
}
boolean isBlank = false;
int endIndex = text.length();
if (text.length() >= 1) {
if (text.charAt(text.length() - 1) == ' ') {
isBlank = true;
endIndex--;
}
}
for (int i = text.length() - 1; i ... | 7 |
public void updateRole( final long id, final String roleStr ) throws IOException {
if( id == 1 ) {
logger.warning("Can't update roles for admin");
return;
}
final UserRole neuRole = UserRole.roleForString(roleStr);
if( neuRole == null ) {
logger.warning("Unknown role.");
return;
}
(new S... | 2 |
public void setType(String type)
{
this.type = type;
} | 0 |
protected void processBackgroundReads() {
logger.info("Processing background reads...");
logger.info("Computing RPKM values using " + threads + " threads...");
long tstart = System.currentTimeMillis();
this.transcripts = new ArrayList<TranscriptRecord>();
GeneModelProducer produ... | 6 |
@Override
public void render(Screen screen) {
super.render(screen);
int dist = getHeight() / SCORES_SHOWN;
int i = 0;
for (Long score : scores) {
if (scaleText)
Art.FONT.render(getX(), getY()+(dist*i), dist, Timer.longToTimeString(score), screen);
else {
Art.FO... | 2 |
public static void main(String[] args) {
Assemble_dir ad = new Assemble_dir();
//if (args==null || args.length==0){
// System.out.println("Usage: java -jar BatchAssemble input directory> <output directory> <lookup table path> <regular expression filter> <overwrite=true/false>");
// System.out.println("Use... | 9 |
private static void renderElements(int windowX, int windowY){
Font.render("Element", windowX + 16, windowY + height - 24);
GL11.glDisable(GL11.GL_TEXTURE_2D);
for(int i = 0; i < 3; i++){
GL11.glColor3f(0.5f, 0.5f, 0.5f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(windowX + 16 + i*32 + i*4, windowY + he... | 1 |
public void selectSquibGroup(int index){
Universe u = sequence.getSquibGroups().get(index).getSquibs();
// Clear any previously selected squibs
visualSchematicController.deselect();
// And select the squibs from the given group
for (Firebox fb : u.getFireboxList())
{
for (Lunchbox lb : fb.getLunchb... | 9 |
private boolean method66(int i, int j, int k)
{
int i1 = i >> 14 & 0x7fff;
int j1 = worldController.method304(plane, k, j, i);
if(j1 == -1)
return false;
int k1 = j1 & 0x1f;
int l1 = j1 >> 6 & 3;
if(k1 == 10 || k1 == 11 || k1 == 22)
{
ObjectDef class46 = ObjectDef.forID(i1);
int i2;
int j2;
... | 7 |
public static void pointIntersectsRectangleOuter(
float pointX, float pointY, float speedX, float speedY, float radius,
float rectX1, float rectY1, float rectX2, float rectY2,
float timeLimit, CollisionResponse response) {
// Assumptions:
assert (rectX1 < rectX2) && (rectY1... | 8 |
@Override
public void close() throws IOException {
if (fileChannel != null) {
fileChannel.close();
}
if (rf != null) {
rf.close();
}
// GC
threadLocalByteBuffer.set(null);
threadLocalByteBuffer = null;
} | 2 |
synchronized public BlockTuple getNextToDoAndStart() throws InterruptedException{
BlockTuple res = null;
while(toDoList.isEmpty() && !workFinished)
wait();
if(workFinished)
//Schalte Thread aus, arbeit ist vorbei;
return null;
//
while(res == null){
if(workFinished)
Thread.currentThread().int... | 9 |
public synchronized void getAvgTempForStnsWithinTimeRange(Date fromDate, Date toDate){
PreparedStatement pstmt = null;
int avgTemp = 0;
String stn = "";
HashMap<Integer, String> hmResult = new HashMap<Integer, String>();
ResultSet rs = null;
try{
conn = DBConnectionMgr.getConnection();
if(conn !=... | 7 |
private void setGSState(String name) throws IOException {
// obj must be a string that is a key to the "ExtGState" dict
PDFObject gsobj = findResource(name, "ExtGState");
// get LW, LC, LJ, Font, SM, CA, ML, D, RI, FL, BM, ca
// out of the reference, which is a dictionary
PDFObje... | 9 |
public int readPackage(int depth, HashMap classes, String packageName,
int count) {
if (depth++ >= MAX_PACKAGE_LEVEL)
return count;
String prefix = packageName.length() == 0 ? "" : packageName + ".";
Enumeration enum_ = ClassInfo.getClassesAndPackages(packageName);
while (enum_.hasMoreElements()) {
// ... | 5 |
public List<Entry> getEntryList() {
List<Entry> list = new LinkedList<>();
try {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM comments ORDER BY time");
if (resultSet == null) {
... | 3 |
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof AirlineException)) return false;
AirlineException other = (AirlineException) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsC... | 9 |
*/
protected void dragExitColumn(DropTargetEvent dte) {
List<Column> columns = mModel.getColumns();
if (columns.equals(mSavedColumns)) {
repaintColumn(mModel.getDragColumn());
} else {
columns.clear();
columns.addAll(mSavedColumns);
repaint();
if (mHeaderPanel != null) {
mHeaderPanel.repaint(... | 2 |
public static String uncompressUtf8(String str){
if (str == null || str.length() == 0) {
return str;
}
try{
int idx = str.indexOf('_');
String len = str.substring(0,idx);
String cont = str.substring(idx+1,str.length());
byte[] compressArr = new byte[Integer.parseInt(len)];
int i = 0;
for(int ... | 9 |
@EventHandler
public void onFlagTake(PlayerInteractEvent e) {
final Player p = e.getPlayer();
if (e.getAction()== Action.RIGHT_CLICK_BLOCK||e.getAction()==Action.LEFT_CLICK_BLOCK) {
final Block b = e.getClickedBlock();
if (CTF.gm.isPlaying(p)) {
if (b.getType(... | 7 |
private static void trimWSFromNode(Node node) {
NodeList children = node.getChildNodes();
for(int i = 0; i < children.getLength(); ++i) {
Node child = children.item(i);
if(child.getNodeType() == Node.TEXT_NODE) {
child.setTextContent(child.getTextContent().trim());
}
... | 2 |
private void open(final JFrame frame) {
final JFileChooser chooser = new JFileChooser(new File(GuiUtils.CURRENT_DIRECTORY));
chooser.setSelectedFile(new File("scsync.config"));
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(frame)) {
final Gson gson = new GsonBuilder().create();
try {
GuiUtil... | 3 |
public static ArrayList<Employee> showAll() {
ArrayList<Employee> employees = new ArrayList<Employee>();
Database db = dbconnect();
try {
db.prepare("SELECT * FROM employee WHERE bDeleted = 0 ORDER BY EID");
ResultSet rs = db.executeQuery();
while(rs.next()) {
... | 2 |
@Test
public void testForcedMove() {
try {
Scanner sc = new Scanner(new File("./test/myBoard.txt"));
//
int xSize = sc.nextInt();
int ySize = sc.nextInt();
//
int [][] newField = new int[xSize][ySize];
for (int y = ySize - 1; y > -1; --y) {
for (int x = 0; x < xSize; ++x) {
newField[... | 7 |
public CheckboxMenuItem getToolTipCheckBox() {
if (toolTipCheckBox == null) {
toolTipCheckBox = new CheckboxMenuItem("Set tooltip");
toolTipCheckBox.setState(true);
toolTipCheckBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
int toolTipCheckBoxId = e.getStateChan... | 2 |
public Point getRoute(int x, int y)
{
if (thread != null) {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return route[y][x];
} | 2 |
@Override
public IMatrix nInvert() {
/*
* inverz se računa kao umnožak inverza determinante matrice i
* transponirane adjungirane matrice početne matrice;
* ukoliko je determinanta 0, tada inverz ne postoji i takva matrica
* naziva se singularna matrica
*/
double determinant = this.determinant();
... | 4 |
@Override
public boolean onKeyDown(int key) {
if(super.onKeyDown(key)) {
return true;
}
if(key == Keyboard.KEY_ESCAPE || key == Keyboard.KEY_TAB) {
Application.get().getHumanView().popScreen();
return true;
}
return true;
... | 3 |
@Override
public void actionPerformed(ActionEvent arg0) {
switch(arg0.getActionCommand()) {
case ("Ok"): {
LAF = lookAndFeel.get(combo1.getSelectedIndex());
if(j != null) {
try {
UIManager.setLookAndFeel(LAF.getClassName());
} catch(ClassNotFoundException | InstantiationException
|... | 3 |
public static void powMatrix(int[][] f, int n){
if(n<2) return;
powMatrix(f, n/2);
twoMatrix(f);
if(n%2 == 1)
oneMatrix(f);
} | 2 |
public synchronized void init() {
Object tmp = library.getObject(entries, "Pages");
pageTree = null;
if (tmp instanceof PageTree) {
pageTree = (PageTree) tmp;
}
// malformed core corner case, pages must not be references, but we
// have a couple cases that bre... | 3 |
public LinkedList<Item> createLinkedList(int items) {
LinkedList<Item> list = new LinkedList<Item>();
for (int i=0;i<items;i++) {
Item item = genItem(i,items);
list.add(item);
}
return null;
} | 1 |
public void setFullscreen(boolean fullscreen) {
if (Client.instance.preferences.video.fullscreen == fullscreen) {
try {
Class<?> application = Class.forName("com.apple.eawt.Application");
Method getApplication = application.getMethod("getApplication");
Object app = getApplication.invoke(null);
Method requ... | 3 |
private String diffStateTreasure(GameState old, GameState curr, Card card)
{
Color faction = card.getFaction();
Loot oldLoot = old.getPlayer(faction).getLoot();
Loot currLoot = curr.getPlayer(faction).getLoot();
if(oldLoot.equals(currLoot))
return null;
for(String t : Treasure.allTreasures())
{
... | 3 |
public static void main(String[] args) {
LiftOff launch = new LiftOff();
launch.run();
} | 0 |
public void forcePlus(Items items, int plus) {
if (plus < 0 || plus > 15)
return;
for (Shoes x : items.getShoes()) {
x.setPlus(plus);
}
for (Gloves x : items.getGloves()) {
x.setPlus(plus);
}
for (Pants x : items.getPants()) {
x.setPlus(plus);
}
for (Armor x : items.getArmors()) {
x.setP... | 7 |
private void calculateSmoothingFactor(){
if (!vocab.isWordUpdated(ID)) {
clusterWords();
//zeros = (K+1)^2 - occupied contexts
//count nonZeros and find the minimum and its frequency
int nonZeros = 0;
int min = 0;
int minValues = 0;
for (int[] ai : clusterContexts){
for (int j : ai){
if ... | 8 |
public void merge(Map<String, Category> categoryMap) {
for (MergerInfo mi : miList) {
List<Player> mergedPlayers = new ArrayList<Player>();
AggregationGroup group = mi.getGroup();
String groupName = group.getKana();
Category category = categoryMap.get(groupName);
System.out.println(category);
Map<St... | 6 |
public Form getForm(int formId) throws FormNotFoundException, ErrorRecreatingFormException {
try {
String q = "select formobject from form where formid = ?";
PreparedStatement st = conn.prepareStatement(q);
st.setInt(1, formId);
ResultSet rs = st.executeQuery();
... | 3 |
@Test
public void findUser(){
Connection conn = null;
Statement statement = null;
ResultSet reSet = null;
try{
conn = JDBCUtils.getConnection();
statement = conn.createStatement();
reSet = statement.executeQuery("select * from table_user");
while(reSet.next()){
String Id = reSet... | 2 |
@Override
public boolean perform(GameEntity performer, GameEntity target) {
if (target instanceof Actor) {
Actor actor = (Actor) target;
if (hardAmount != 0) {
actor.addHealth(hardAmount);
} else if (dynamicAmount != null) {
int maxHealth =... | 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.