text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void gameLoop() {
long previousTick = System.nanoTime();
long previousUpdate = System.nanoTime();
long nanosecondsPerUpdate = (long) ((float) MathHelper.MILLIARD / (float) updaterate);
while (!Display.isCloseRequested() && isRunning) {
long currentTime = System.nanoTime();
long deltaTime = curren... | 4 |
public int[] getAvgColorAsRgba(Point p1, Point p2, Point p3) {
Edge[] edges = new Edge[3];
edges[0] = new Edge(p1, p2);
edges[1] = new Edge(p2, p3);
edges[2] = new Edge(p3, p1);
List<Integer> endPoints = new ArrayList();
boolean onRightSide = gatherEndPoints(edges, endPo... | 2 |
public void testWithField_DateTimeFieldType_int_2() {
LocalDateTime test = new LocalDateTime(2004, 6, 9, 10, 20, 30, 40);
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public void clear() {
//find out the row/column that has 0, indicate it with boolean set
int[][] matrix_clear = new int[row][column];
boolean[] row_with_zero = new boolean[row];
boolean[] column_with_zero = new boolean[column];
for(int i=0; i<row; i++) {
for(int j=0; j<column; j++) {
if(matrix[i][j]... | 7 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
do {
line = in.readLine();
if (line == null || line.length() == 0)
break;
int[] trh = retInts(line);
tr... | 8 |
RoomScheme generateRandomScheme(int days, int classTimes, Subject[] s){
Subject[][] sub = new Subject[days][classTimes];
RoomScheme r;
for(int i=0; i<days; i++){
for(int j=0; j<classTimes; j++){
sub[i][j] = s[(int)(Math.random()*(s.length))];
}
... | 2 |
public int selectFinalLabel( int vectorIndex){
//we can have max 10 labels
int[] labelCount = new int[10];
int result = -1;
// find the count for each label
for(int i=0; i<minKLabels.length; i++){
labelCount[minKLabels[i]]++;
}
HashSet<Integer> labelsWithHighestCount = new HashSet<Integer>();
... | 7 |
public static String cleanUrl(String dirtyUrl)
{
String result = "";
//dirtyUrl = dirtyUrl.replaceAll("www.", "");
dirtyUrl = dirtyUrl.replaceAll("http://", "");
dirtyUrl = dirtyUrl.replaceAll("https://", "");
result = "http://" + dirtyUrl;
// result = "http://www." + dirtyUrl;
_logger.debug("Dirty-URL: "... | 0 |
public void activePlayerDoAction(Action actionToDo) throws InvalidActionException{
actionToDo.doAction(getActivePlayer(), getGrid());
if(actionToDo instanceof EndTurnAction)
activePlayerEndTurn();
if (getActivePlayer().getRemainingTurns() <= 0)
activePlayerEndTurn();
} | 2 |
@BeforeClass
public static void beforeClass() {
System.out.println("Testing PhonewordFinder Started.");
_dictionary = new WordReader("/dict4test.txt");
_phonewordFinder = new PhonewordFinder(_dictionary);
} | 0 |
public void ensureCapacity(int minCapacity) {
int oldCapacity = data.length;
if (minCapacity > oldCapacity) {
int oldData[] = data;
int newCapacity = (oldCapacity * 3)/2 + 1;
if (newCapacity < minCapacity) {
newCapacity = minCapacity;
}
data = new int[newCapacity];
System.arraycopy(oldData,... | 2 |
public IrcModeChange(String modes) {
char sign = ' ';
plus = new ArrayList<>();
minus = new ArrayList<>();
for (char c : modes.toCharArray()) {
if (c == '+' || c == '-') {
sign = c;
continue;
}
if (sign == '+')
... | 5 |
public void write(OutStream os) {
os.writeU8(bpp);
os.writeU8(depth);
os.writeU8(bigEndian ? 1 : 0);
os.writeU8(trueColour ? 1 : 0);
os.writeU16(redMax);
os.writeU16(greenMax);
os.writeU16(blueMax);
os.writeU8(redShift);
os.writeU8(greenShift);
os.writeU8(blueShift);
os.pad(3... | 2 |
public Object readSymbol()
throws IOException {
if (trace >= API_TRACE_DETAILED) {
debugNote("About to read symbol name.");
}
Object response = readObject();
if (!(response instanceof String)) {
throw new CycApiException("Expecting a String, got: " + response.getClass() + " for ob... | 3 |
private void makeFlushArray() {
_flushArray = new char[0x1fc1];
for (int cn0 = 0; cn0 < RANK_SIZE; cn0++) {
for (int cn1 = cn0 + 1; cn1 < RANK_SIZE; cn1++) {
for (int cn2 = cn1 + 1; cn2 < RANK_SIZE; cn2++) {
for (int cn3 = cn2 + 1; cn3 < RANK_SIZE; cn3++) {
for (int cn4 =... | 9 |
public static void format(InStream inStream, OutStream outStream,FormatSettings formatSettings) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException {
indentString = formatSettings.getIndentString();
char currentSymbol;
handlers = formatSettings.getHandlersL... | 7 |
private void menu() {
String option = "";
while (isRunning) {
System.out.println();
System.out
.println("Cac tham so khi su dung chuong trinh. Click vao man hinh chon phim can dung");
System.out
.println("- Q Ket thuc chuong tring. Khong duoc tat truc tiep phai dung Q de luu du lieu.");
Syste... | 3 |
public Set<AndroidMethod> parse() throws IOException{
Set<AndroidMethod> methodList = new HashSet<AndroidMethod>(INITIAL_SET_SIZE);
Pattern p = Pattern.compile(regex);
Pattern pNoRet = Pattern.compile(regexNoRet);
for(String line : this.data){
if (line.isEmpty() || line.startsWith("%"))
continue;
... | 5 |
private static void processParameters(String[] args) {
if (args.length == 0) {
showUsage();
System.exit(1);
}
for (int i = 0; i < args.length; i++) {
String opt = args[i];
if (opt.startsWith("--template")) {
if ((i + 1) < args.leng... | 5 |
static void blitscreen_dirty1_vga() {
int w, h;
/* while (true)
{*/
for (int i = 0; i < scrbitmap.height; i++) {
System.arraycopy(scrbitmap.line[i].memory, scrbitmap.line[i].offset, back_buffer, i * scrbitmap.width, scrbitmap.width);
}
{
int ... | 9 |
private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... | 8 |
private String getValue(Integer[] card){
String o = "", k;
switch (card[0]){
case 0: o += "\u2660"; break; //Spade
case 1: o += "\u2665"; break; //Heart
case 2: o += "\u2663"; break; //Club
case 3: o += "\u2666"; break; //Diamond
}
switch (... | 8 |
private boolean areRegistrationCredentialsValid(Player player, String retypedPassword) {
boolean valid = false;
if (player.getFirstName().isEmpty()) {
MMessageBox.show(REGISTRATION_FIRST_NAME_EMPTY);
this.firstName.setValid(valid);
} else if (player.getLastName().isEmpty()) {
MMessageBox.show(REGISTRATI... | 8 |
@Override
public void close() throws ChannelException {
if (port != null) {
port.removeEventListener();
port.close();
port = null;
}
inputStream = null;
outputStream = null;
super.close();
} | 1 |
public static void main(String[] args) {
System.out.print("Zadej slovo: ");
String slovo = VstupString.ctiString();
switch (slovo.toLowerCase().charAt(slovo.length() - 1)) {
case 'l': slovo = new String(slovo.toLowerCase());break;
case 'u': slovo = new String(slovo.toUpperCase());break;
... | 8 |
public void addColumn() {
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Entity past_string = null;
try {
past_string = datastore.get(KeyFactory.createKey("past_string",
"onlyOne"));
} catch (EntityNotFoundException e) {
}
String[] string_box = ((Text) past_string.g... | 3 |
protected File setData(String data, String suffix){
//uuid timestamp script
UUID gen = UUID.randomUUID();
File script = new File(String.valueOf(gen.toString())+suffix);
//duplicate avoidance
while(script.exists()){
//try to wait a short random time
try {
wait((int)(Math.random()*100));
} catch ... | 3 |
private void factor(){
//System.out.println("in factor");
if( is(TK.LPAREN) ) {
gcprint("(");
scan();
expression();
mustbe(TK.RPAREN);
gcprint(")");
}
else if( is(TK.ID) ) {
rvalue_id(tok.string, tok.lineNumber);
... | 4 |
@Override
public SimpleGraph remove(GraphComponent component)
{
if(component == null)
throw new IllegalArgumentException("given components is null.");
if(!contains(component))
lr(this, "component [] not contained", component);
if(component instanceof Node)
nodes.remove(component);
else if(component i... | 6 |
public List<String> reverseSortedKeys() { //Returns a List of Strings, sorted based on their corresponding values.
List<String> keysList = new ArrayList<String>();
Iterator<IntKeyValuePair> i = getKVPs().iterator();
while(i.hasNext()) {
keysList.add(0, i.next().getKey());
}
return keysList;
} | 1 |
private boolean jj_3R_35() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_19()) {
jj_scanpos = xsp;
if (jj_3_20()) return true;
}
return false;
} | 2 |
static public int longLength (long value, boolean optimizePositive) {
if (!optimizePositive) value = (value << 1) ^ (value >> 63);
if (value >>> 7 == 0) return 1;
if (value >>> 14 == 0) return 2;
if (value >>> 21 == 0) return 3;
if (value >>> 28 == 0) return 4;
if (value >>> 35 == 0) return 5;
if (value >... | 9 |
public String toString() {
StringBuffer text = new StringBuffer();
if (m_t == null)
return "Gaussian Processes: No model built yet.";
try {
text.append("Gaussian Processes\n\n");
text.append("Kernel used:\n " + m_kernel.toString() + "\n\n");
text.append("All values shown based ... | 9 |
@Transient
public Date getFunFechaCambioClave() {
return funFechaCambioClave;
} | 0 |
private void drawRect(int rx1, int ry1, int w, int h, int c, boolean fill)
{
if (fill)
{
for (int x = rx1; x < rx1 + w; x++)
for (int y = ry1; y < ry1 + h; y++)
drawPoint(x, y, c);
}
else
{
for (int x = rx1; x < rx1 ... | 5 |
public static void main(String[] args) throws IOException {
int height = 100;
int[][] triangle = new int[height][height];
File file = new File("0067/triangle.txt");
List<String> lines = FileUtils.readLines(file);
int y = 0;
for (String line : lines) {
String[] numbers = line.split(" ");
int x = 0;
... | 4 |
private void setSpaceCoords() {
int x = WIDTH - 77, y = HEIGHT - 88;
int xIncrement = 95, yIncrement = 68;
for(int i = 0; i < spaceCoords.length; i++) {
spaceCoords[i][0] = x;
spaceCoords[i][1] = y;
// Bottom row
if(i < 10)
x -= xIncrement;
// Left row
else if(i < 20)
y -= yIncreme... | 4 |
public static void filledCircle(double x, double y, double r) {
if (r < 0) throw new RuntimeException("circle radius can't be negative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
double hs = factorY(2*r);
if (ws <= 1 && hs <= 1) pixel(x, y);... | 3 |
public static void getConnection() {
try {
logger.info("Connecting with Server ...");
wait = prop.getInt("ThreadSleep_period");
int portNumber = prop.getInt("port_number");
String hostAddress = prop.getString("host_address");
requestSocket = new Socket(hostAddress, portNumber);
logger.info("Server i... | 4 |
public JSONArray optJSONArray(int index) {
Object o = opt(index);
return o instanceof JSONArray ? (JSONArray)o : null;
} | 1 |
static SGFProperty fromString(StringBuffer sgf)
throws IncorrectFormatException {
/* Remove leading whitespace */
if (!Character.isUpperCase(sgf.charAt(0))) {
throw new IncorrectFormatException();
}
String propIdent = String.valueOf(sgf.charAt(0));
sgf.deleteCha... | 8 |
private void saveMidi(boolean flag, byte buf[]) {
Signlink.midifade = flag ? 1 : 0;
Signlink.midisave(buf, buf.length);
} | 1 |
@EventHandler
protected void onPlayerDammage(EntityDamageByEntityEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player) {
Player player = (Player) entity;
ScavDuelsPlayer dPlayer2 = ScavDuels.scavDuelsPlayer.get(player.getName());
if (dPla... | 4 |
private void drawComponent(Graphics paramGraphics, Component paramComponent, Rectangle paramRectangle)
{
if (paramComponent.isVisible())
{
ImageComponent localImageComponent;
if ((paramComponent instanceof ImageComponent))
{
localImageComponent = (ImageComponent)paramComponent;
... | 8 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
CambiarContrasena cambioContr = new CambiarContrasena();
String claveOriginal = jTextField1.getText();
System.ou... | 7 |
private static String getGameLine(HanoiGame game, int i) {
Disk currentDisk;
StringBuilder stringBuilder = new StringBuilder();
for (int j = 0; j < game.getCurrentSituation().size(); j++) {
currentDisk = game.getCurrentSituation().get(j).see(i);
stringBuilder.append(HanoiTools.repeat(" ", game.getNumberOfDi... | 4 |
public synchronized TestInfo createTest(String userKey, String testName) {
TestInfo testInfo = null;
if (userKey == null || userKey.trim().isEmpty()) {
BmLog.debug("Test cannot be created, userKey is empty");
return null;
}
String url = this.urlManager.scriptCrea... | 3 |
public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbSecGroupByUNameIdxKey ) {
GenKbSecGroupByUNameIdxKey rhs = (GenKbSecGroupByUNameIdxKey)obj;
if( getRequiredClusterId() < rhs.getRequiredClusterId() ) {
return( -1 );
}
else if( getRequiredCluste... | 9 |
public void doMagCdf(int first, int last, int date) throws CDFException{
int numOfRecs = last - first;
int[]
frameGroup = new int[numOfRecs],
q = new int[numOfRecs];
long[] epoch = new long[numOfRecs];
float[]
magx = new float[numOfRecs],
magy = new float[... | 7 |
public RemoteCallCountLimitException(String message) {
super(message);
} | 0 |
void populateTable() {
// if there are any data, remove them from the table first
while (tableModel.getRowCount() > 0) {
tableModel.removeRow(0);
}
tableModel.setColumnCount(0);
int numberOfRows = pointer / 2;
Object t[] = new Object[numberOfRows];
for (int i = 0; i < numberOfRows; i++) {
t[i] = i... | 9 |
public Object getValueAt(int row, int col) {
Object result = null;
if(col==0)
result = parts[row].getGateClass().getName();
else if (col==1) {
if (parts[row] instanceof CompositeGate)
result = COMPOSITE_GATE;
else i... | 5 |
public int login( int id, int password, int type ){
int flag = 0;
if( !handler_info.initialize() ){
System.out.println( "LoginServer : failed to initialize personinfo handler" );
return ERROR_DATABASE;
}
int psd = handler_info.getPassword(id);
if( psd == -1 )
flag = ERROR_ID;
else if( password != p... | 6 |
public void close() throws IOException {
super.close();
closed = true;
} | 0 |
@Override
public Object getValue() {
return rawFrameContents;
} | 0 |
@Override
public void onEnter() {
task = new CountdownTask(getGame().getPlugin(), 30) {
@Override
protected void onFinish() {
getGame().nextState();
}
@Override
protected void onTick(int tick) {
if(tick %5 == 0 |... | 3 |
public void robPlayer(RobPlayerInfo victim) {
if(presenter.getState().getStatus().equals("Robbing")){
if(victim!=null){
presenter.robPlayer(presenter.getPlayerInfo().getIndex(),victim.getPlayerIndex(), robberSpot);
}else{
presenter.robPlayer(presenter.getPlayerInfo().getIndex(), -1, robberSpot);
}
... | 3 |
@Override
public void deconnect(String nick) {
if (timeOut.containsKey(nick)) {
timeOut.remove(nick);
}
} | 1 |
public Card(CardType type, int value) {
this.type = type;
this.value = value;
} | 0 |
public static void main(String[] ops) {
try {
// Create numeric attributes "length" and "weight"
Attribute length = new Attribute("length");
Attribute weight = new Attribute("weight");
// Create date attribute "date"
Attribute date = new Attribute("date", "yyyy-MM-dd HH:mm:ss"... | 8 |
public int getLocationId(int x, int y, int z, int worldId) {
int locationId = 0;
try {
connect();
PreparedStatement statement = connection.prepareStatement("SELECT id FROM location WHERE x = ? AND y = ? AND z = ? AND world_id = ?");
statement.setInt(1, x);
... | 3 |
public Departamento selectDepartamentoPorCodigo(String COD_DEPARTAMENTO) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Departamento DEP = null;
try {
conexao = BancoDadosUtil.getConnection();
... | 7 |
private boolean areSiblingsSelected(TreePath path) {
TreePath parent = path.getParentPath();
if (parent == null) {
return true;
}
Object node = path.getLastPathComponent();
Object parentNode = parent.getLastPathComponent();
int childCount = model.getChildCount(parentNode);
for (int i = 0; i < childCou... | 4 |
private String Term() { //getting values
boolean error = false;
if(current.getId().equals("VARNAME")) {
String name = current.getLexeme();
nextToken();
if(current.getId().equals("LSBRACKET")) {
nextToken();
if(current.getId().equals("VALNUM")) {
String index = current.getLexeme();
nextTok... | 9 |
@Test
public void WhenSerializingValidRoutingTable_ExpectResults() throws UnknownHostException {
int levels = 2;
int levelSize = 2;
StringBuilder builder = new StringBuilder();
for (int i = 0; i < levels; i++) {
builder.append("0");
}
String expectedLoca... | 7 |
public static Long readInt(final IBStream stream) {
char ch = stream.getChar();
checkChar(BConst.INT_START, ch);
long val = 0;
boolean negative = false;
boolean leadZero = false;
ch = stream.getChar();
if (BConst.SIGN == ch) {
negative = true;
... | 9 |
private boolean deprojectivizeWithHead(DependencyStructure pdg, DependencyNode node) throws MaltChainedException {
boolean success = true, childSuccess = false;
int i, childAttempts = 2;
DependencyNode child, possibleSyntacticHead;
String syntacticHeadDeprel;
if (nodeLifted.get(node.getIndex())) {
syntacti... | 9 |
public boolean CompareSuccess(Field f, Object compareValue, String compareFunction) {
// switch(String) only in 1.7
if(cfg.compareEqual.equals(compareFunction)) {
return f.compare(compareValue);
} else if(cfg.compareNotEqual.equals(compareFunction)) {
return !f.compare(co... | 8 |
public static void shortestPaths(List<Edge>[] edges, int s, long[] prio, int[] pred) {
Arrays.fill(pred, -1);
Arrays.fill(prio, Long.MAX_VALUE);
prio[s] = 0;
Queue<QItem> q = new PriorityQueue<QItem>();
q.add(new QItem(0, s));
while (!q.isEmpty()) {
QItem cur = q.poll();
if (cur.prio... | 4 |
public String matchQueryWordToProduct(String oldQuery,
HashSet<String> prodWords) {
String[] oldQueryArray = oldQuery.split(" ");
// System.out.println(oldQuery);
StringBuilder sb = new StringBuilder();
for (int i = 0 ; i < oldQueryArray.length; i ++) {
if (isNumeric(oldQueryArray[i]) || oldQueryArray[i].... | 5 |
public void run() {
while (s >= 0) {
ultimaEscritura(nombre);
if (s == 0)
{
cont--;
System.out.println(nombre + " - " + s + " - ultima escritura "
+ IDanterior);
System.out.println("ultima escritura " + nombre + " - " + cont
+ " Threads activos");
}
else {
System.o... | 3 |
@Override
public void destroy() {
parent = null;
oldNode = null;
newNode = null;
} | 0 |
static final public void sum() throws ParseException {
term();
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUS:
case MINUS:
;
break;
default:
jj_la1[1] = jj_gen;
break label_1;
}
switch ((jj_ntk==-1)?jj_ntk():jj_nt... | 7 |
private List<ProductCombination> getValidDeals( List<ProductCombination> allCombinations) {
List<ProductCombination> validDeals = new ArrayList<ProductCombination>();
Product prod = null;
ProductCombination tempCombo = null;
Item item = null;
Item desiredItem = null;
// An array of boolean flags to s... | 8 |
@Override
public LoginResponse login(LoginRequest request) throws IOException {
//System.out.println(proxyCli.getReadQuorum() + " "+ proxyCli.getWriteQuorum());
for(UserModel user : proxyCli.getUsers()) {
if(user.getName().compareTo(request.getUsername()) == 0 && user.getPassword().compareTo(request.getPassword... | 3 |
@Override
protected Object getColumnValue(StockItem item, int columnIndex) {
switch (columnIndex) {
case 0:
return item.getId();
case 1:
return item.getName();
case 2:
return item.getPrice();
case 3:
return item.getQuantity();
}
throw new IllegalArgumentException("Column index out of range");... | 4 |
public MyList findOneTileMovesTo(Hexpos end, String player) {
// check if goal position is empty
if (owner.get(end) != null)
return null;
// make a list to store the moves
MyList moves = new MyList();
// try to find *one* neighbour-step move
MyList neighbours = end.neighbours(); // neighbours... | 4 |
@Override
public boolean equals( Object o )
{
return (o != null && o instanceof URIMatcher) ? toString().equals( o.toString() ) : false;
} | 2 |
public ThoughtsPopUp(final boolean save) {
this.save = save;
setMinimumSize(new Dimension(350, 500));
setResizable(false);
setLayout(null);
JLabel nameLabel = new JLabel("Action Name: ");
nameLabel.setBounds(STANDARD_MARGIN_X, STANDARD_MARGIN_Y + 0 * LABEL_HEIGHT, LAB... | 6 |
private static Combination<Colors> generateAttemptCombination(int i) {
List<Token<Colors>> tokens = new ArrayList<Token<Colors>>();
if (i == 1) {
tokens.add(new Token<Colors> (Colors.R));
tokens.add(new Token<Colors> (Colors.O));
tokens.add(new Token<Colors> (Colors.Y));
tokens.ad... | 3 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 7 |
public String getEntry(int ix) {
return strings[ix];
} | 0 |
protected void getJars(List<String> jars, File file) {
JarFilter jarFilter = new JarFilter();
DirectoryFilter directoryFilter = new DirectoryFilter();
if (file.exists() && file.isDirectory() && file.isAbsolute()) {
String[] jarList = file.list(jarFilter);
for (int i = 0; (jarList != null) && (i < jarList.l... | 7 |
public String getMinecraftForumUser(Connection con, String mc_name) {
/* Compose query. */
String SQL_QUERY = "SELECT username "
+ "FROM xf_user "
+ "INNER JOIN xf_user_field_value "
+ "ON xf_user.user_id = xf_user_field_value.user_id "
+ "WHERE xf_user_field_value.field_id=\"minecraftid\" "
+ "... | 2 |
public static boolean hashesEqual (byte[] hash1, byte[] hash2) {
if (hash1 == null) return hash2 == null;
if (hash2 == null) return false;
int targ = 16;
if (hash1.length < 16) {
if (hash2.length != hash1.length) return false;
targ = hash1.length;
} else i... | 7 |
public DigraphLayout<V,E> layout(Digraph<V,E> digraph, DigraphLayoutDimensionProvider<V> dimensions, Digraph<V,?> feedback) {
if (digraph.getVertexCount() == 0) {
return new DigraphLayout<V,E>(Digraphs.<DigraphLayoutNode<V>,DigraphLayoutArc<V,E>>emptyDigraph(), new DigraphLayoutDimension(0, 0));
}
DoubledDigra... | 8 |
public Object[] getAvailableAnnotations(){
try {
return getAnnotations(true);
}
catch (ClassNotFoundException e) {
throw new RuntimeException("Unexpected exception ", e);
}
} | 1 |
@Override
Integer deleteEntity(Criteria criteria, AbstractDao dao) throws DaoException {
criteria.addParam(DAO_COUNTRY_STATUS, DELETED);
Integer res = updateCountry(criteria, dao);
List<Country> list = getEntity(criteria, dao);
for (Country c : list) {
List<City> cities =... | 2 |
public static int countLines(File cardfile) {
try {
LineNumberReader reader = new LineNumberReader(new FileReader(cardfile));
int cnt = 0;
while (reader.readLine() != null) {}
cnt = reader.getLineNumber();
reader.close();
return cnt;
} catch (Exception e) {
return 0;
}
} | 2 |
public void drawPacman(Graphics g) {
if (direction == 'u') {
if (current > pictureUp.length - 1) {
current = 0;
}
g.drawImage(pictureUp[current], pacmanRow * 20, pacmanCol * 20, 22, 22, maze);
}
if (direction == 'd') {
if (current... | 8 |
public void PreInit(ContentManager manager, Config cfg) {
this.initTextures(manager.getAssetManager());
} | 0 |
public static String[] getAllSchoolName(BaseSetting bs) {
if (bs == null) {
System.out.println("school - BS NULL");
} else {
//On initialise la liste des écoles
ArrayList<String> list = new ArrayList<>();
try {
//
//Si la... | 5 |
private void validate(SortedMap<Integer, Integer> costByDemandMap){
int previousPrice = MAX_COST + 1;
for(int demand:costByDemandMap.keySet()){
if (demand == Integer.MIN_VALUE){
throw new IllegalArgumentException("Demand cannot be Integer.MIN_VALUE (" + Integer.MIN_VALUE + ")");
}
if (costByDemandMap.g... | 5 |
@Path("/admin/profiles.json")
@Produces(MediaType.APPLICATION_JSON)
@POST
public String insertProfiles(
@Context HttpServletRequest request,
@Context HttpServletResponse response,
@QueryParam("json") String json ) {
if( !checkHostInfo(request.getRemoteHost(),
AdminProperties.getHttp_allowed()) ) {
... | 5 |
private static List<String> getInstallationQueue(JSONObject packConfig, String packVersion) {
//Get version entries
Logger.info("Instances.getInstallationQueue", "Getting entry list...");
JSONArray entriesArray = null;
if (packVersion.equalsIgnoreCase("recommended")) {
... | 7 |
public static boolean buscaCliente(int indice, HashMap<Integer, Clientes> tablaClientes)
{
boolean encontrado = false;
int key;
Set<Entry<Integer,Clientes>> s = tablaClientes.entrySet();
Iterator<Entry<Integer, Clientes>> it=s.iterator();
Entry<Integer, Clientes> m = null;
while (it.hasNext()) // Bu... | 2 |
public void setLogin(String login) {
this.login = login;
} | 0 |
public String asVectorString() {
if (this.rows.length != 1) {
throw new IllegalArgumentException("I'm not a vector!");
}
StringBuilder sb = new StringBuilder();
Node current = this.rows[0];
for (int colIndex = 0; colIndex < this.numCols; colIndex++) {
if (current != null && colIndex == curren... | 4 |
private void reserverSalle() {
System.out.println("Liste de vos modules :");
Professeur professeur = (Professeur) this.modeleApplication.getCurrent();
ArrayList<Seance> seances = this.universite.getSeancesParProfesseur(professeur);
if (seances.isEmpty()) {
System.out... | 5 |
@Override
protected void pick(String name) {
//Shoot MOUSEBUTTON
if (name.equals(KeyMapper.PLAYER_SHOOT) && ammoManager.getMagazineCount() > 0) {
if ((System.currentTimeMillis() - lastPick) > triggerDelay) {
lastPick = System.currentTimeMillis();
super.pic... | 5 |
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.