text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean equals(Object o) {
if (!(o instanceof Quaternion) ) {
return false;
}
if (this == o) {
return true;
}
Quaternion comp = (Quaternion) o;
if (Float.compare(x,comp.x) != 0) return false;
if (Float.compare(y,comp.y) != 0) retur... | 6 |
@Override
public void hyperlinkUpdate(HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
try {
String url = event.getDescription();
if (url != null) {
client.openInBrowser(url);
}
} catch(Exception e) {
e.p... | 3 |
public static void main(String[] args) throws FileNotFoundException, IOException{
Set<String> sw = StopWord.getStopWords();
List<String> dataFiles = new ArrayList<String>();
File[] files = new File("lyricsdata").listFiles();
// Detect what files to clean.
for (File file : files) {
if (file.isFile()) ... | 7 |
public void setNumberOfTransactions(BigInteger value) {
this.numberOfTransactions = value;
} | 0 |
public void setSelectedColor(int button, Color c)
{
switch (button)
{
case MouseEvent.BUTTON1:
setLeft(c);
return;
case MouseEvent.BUTTON3:
setRight(c);
return;
default:
if ((button & (MouseEvent.BUTTON1_MASK | MouseEvent.BUTTON1_DOWN_MASK)) != 0) setLeft(c);
if ((button & (Mouse... | 4 |
public static void botMove(Field field){
boolean setRandomCell = false;
while (!setRandomCell) {
int randomXCoordinate = (int)(Math.random()*field.getFieldSize());
int randomYCoordinate = (int)(Math.random()*field.getFieldSize());
if(randomXCoordinate < field.getFiel... | 3 |
public void reorderList(ListNode head) {
//find mid
if (head == null || head.next == null) {
return;
}
ListNode p1 = head;
ListNode p2 = head;
ListNode midPre = head;
while (p1.next != null && (p2.next != null && p2.next.next != null)) {
p1... | 8 |
public void updateNPC(Player plr, stream str) {
updateBlock.currentOffset = 0;
str.createFrameVarSizeWord(65);
str.initBitAccess();
str.writeBits(8, plr.npcListSize);
int size = plr.npcListSize;
plr.npcListSize = 0;
for(int i = 0; i < size; i++) {
if(plr.RebuildNPCList == false && plr.withinDista... | 9 |
void setItemFont () {
if (!instance.startup) {
tabFolder1.getItem (0).setFont (itemFont);
setExampleWidgetSize();
}
/* Set the font item's image to match the font of the item. */
Font ft = itemFont;
if (ft == null) ft = tabFolder1.getItem (0).getFont ();
TableItem item = colorAndFontTable.getItem(ITEM... | 3 |
* @return Returns true if the cell is a swimlane.
*/
public boolean isSwimlane(Object cell)
{
if (cell != null)
{
if (model.getParent(cell) != model.getRoot())
{
mxCellState state = view.getState(cell);
Map<String, Object> style = (state != null) ? state.getStyle()
: getCellStyle(cell);
... | 5 |
public static void main(String[] args) throws SQLException{
int choice = -1;
DBtask db = new DBtask();//create new database access object
db.getConnection();//establish a connection
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
//while(choice < 0){
System.out.print("Please enter... | 9 |
public boolean marked(int v) {
return marked[v];
} | 0 |
point call(side s, int dir, edge base, point o) throws Coordinator.KilledException {
// o is at far end of base
if (s.a == bottom) {
// region is a singleton
return null;
}
point c = s.a.points[1-s.ai];
if (externAngle(o, s.p, c, dir)) {
// no more candi... | 5 |
public static Double getDouble(final Context context, final int position) {
if (position < 0 || context.arguments.size() <= position) return null;
if (!Parser.isDouble(context.arguments.get(position))) return null;
return Double.parseDouble(context.arguments.get(position));
} | 3 |
protected static Ptg calcOct2Hex( Ptg[] operands )
{
if( operands.length < 1 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "OCT2HEX" );
long l = (long) operands[0].getDoubleVal(); // avoid sci notation
String oString = String.valueOf( l ).trim();
// 10 digits at most (=30 bits... | 8 |
private void calculateGridOffset(Grid grid, GridPoint centerOn) {
int gridWidthPx = grid.width * this.tileSize;
int gridHeightPx = grid.height * this.tileSize;
if (gridWidthPx <= this.gridSpace.width && gridHeightPx <= this.gridSpace.height) {
// The grid fits in the space we have with room to spare. The
//... | 8 |
private int GetBlockLenth(String BlockText) {
int nBlockLineCount = 0;
try {
if(("" == BlockText)||(null == BlockText)){
return 0;
}
BufferedReader br = new BufferedReader(new StringReader(BlockText));
while( br.readLine() != null) {
nBlockLineCount++;
}
return nBlockLin... | 4 |
public FileProtocol getProtocol() {
return this.protocol;
} | 0 |
@Test
public void test_solvable_matrix_size_3_solve() throws
ImpossibleSolutionException,UnsquaredMatrixException,
ElementOutOfRangeException{
int height=3;
int width=3;
float[] result;
try{
test_matrix = new Determinant(height,w... | 3 |
static private final boolean cvc(int i)
{ if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} | 7 |
public void testProperty() {
DateMidnight test = new DateMidnight();
assertEquals(test.year(), test.property(DateTimeFieldType.year()));
assertEquals(test.dayOfWeek(), test.property(DateTimeFieldType.dayOfWeek()));
assertEquals(test.weekOfWeekyear(), test.property(DateTimeFieldType.weekO... | 2 |
static int count(String s)
{
int t=0;
for(int i=0;i<s.length();i++)
{
switch(s.charAt(i))
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u': break;
default: t++;
... | 6 |
public CropDialog(final Panel panel) {
setBounds(1, 1, 270, 190);
Toolkit toolkit = getToolkit();
Dimension size = toolkit.getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
JPanel pan1 = new JPanel();
pan1.se... | 9 |
public static boolean isInteger(String str) {
if (str == null) {
return false;
}
int length = str.length();
if (length == 0) {
return false;
}
int i = 0;
if (str.charAt(0) == '-') {
if (length == 1) {
return fals... | 7 |
public ResultSet pesquisa(String NomeProjeto, String Departamento) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Projeto projet = null;
try {
conexao = BancoDadosUtil.getConnection();
com... | 6 |
private void install()
throws ExInstaller {
//Establish a SYS connection
DatabaseConnection lDatabaseConnection;
try {
if(!mCommandLineWrapper.hasOption(CommandLineOption.PROMOTE_USER)){
mCommandLineWrapper.overrideOption(CommandLineOption.PROMOTE_USER, "SYS");
}
lDatabaseConnec... | 7 |
@Override
public void doAction(String value) {
switch (value) {
case "DAS": this.displayAverageScore();
break;
case "DAA": this.displayAverageScore();
break;
case "DLL": this.displayAverageScore();
break;
... | 3 |
public static Cons generateDescriptionsAsRule(Description head, Description tail, Proposition rule, boolean reversepolarityP) {
{ boolean forwardarrowP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(rule.dynamicSlots, Logic.SYM_LOGIC_FORWARD_ONLYp, Stella.FALSE_WRAPPER))).wrapperValue &&
(!reversepolar... | 9 |
static ArrayList<NoSchemaDocument> generateCustomers(int count, ArrayList<NoSchemaDocument> accounts) {
ArrayList<NoSchemaDocument> customers = new ArrayList<NoSchemaDocument>();
ArrayList<NoSchemaDocument> addressesData = generateAddresses(count);
for (int i=0;i<count;i++) {
NoSchem... | 5 |
public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
String expected = "";
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSequences[i].length;
... | 9 |
@Before
public void setUp() {
l = new DoublyLinkedList();
} | 0 |
public void loadScheme() {
final String discreteModelFilePath = dlgDiscreteModel.open();
if (discreteModelFilePath != null) {
Yaml yaml = new Yaml();
InputStream stream = null;
try {
stream = new FileInputStream(discreteModelFilePath);
} ca... | 3 |
public Sequence(int size) {
items = new Object[size];
} | 0 |
protected static List<Field> getDBFields(Class<?> cls) {
ArrayList<Field> r = new ArrayList<Field>();
for (Field f : cls.getFields()) {
if (f.isAnnotationPresent(Column.class))
r.add(f);
}
return r;
} | 3 |
static final void method1367(int i, int i_0_, float f, int i_1_,
float[] fs, int i_2_, int i_3_, int i_4_,
int i_5_, int i_6_, float[] fs_7_) {
try {
i_2_ -= i;
anInt2409++;
i_1_ -= i_3_;
i_4_ -= i_5_;
float f_8_ = (float) i_2_ * fs_7_[2] + (fs_7_[1] * (float) i_4_
+ fs_7_[... | 7 |
public Header readFrame() throws BitstreamException
{
Header result = null;
try
{
result = readNextFrame();
// E.B, Parse VBR (if any) first frame.
if (firstframe == true)
{
result.parseVBR(frame_bytes);
firstframe = false;
}
}
catch (BitstreamException ex)
{
if ((ex.getErrorCo... | 6 |
@Override
public void createPlayer(Player player) {
checkDataSource();
validate(player);
if (player.getId() != null) {
throw new IllegalArgumentException("Player already exists " + player);
}
try (Connection conn = dataSource.getConnection();
Prep... | 6 |
private Map<Integer, Double> getNeighbors(int userID, int resID) {
Map<Integer, Double> neighbors = new LinkedHashMap<Integer, Double>();
//List<Map<Integer, Integer>> neighborMaps = new ArrayList<Map<Integer, Integer>>();
// get all users that have tagged the resource
for (UserData data : this.trainList) {
... | 8 |
public static void main(String[] args){
if (args.length != 2){
throw new RuntimeException("invalid number of arguments. Must receive two argument specifying working directory and server hostname!!!");
}
workingDir = args[0].replace("\\", "/");
if (workingDir.charAt(workingDir.length() - 1) != '/')
working... | 8 |
public CryptoModuleInfoType createCryptoModuleInfoType() {
return new CryptoModuleInfoType();
} | 0 |
public static String SPARQLQuery(Model model, String queryType) {
// get get all statements for a certain element
if (queryType.equalsIgnoreCase("pathway")) {
query = "CONSTRUCT { ?s ?p ?o } " +
"WHERE { ?s a <http://vocabularies.wikipathways.org/wp#Pathway> . " +
"?s ?p ?o }";
} else if (query... | 5 |
String extract(String line, String key) {
// System.err.println("line in extract |" + line + "|");
line = line.replace('\'', '\"'); // some sites use ' instead of "
// System.err.println("line in extract after replace |" + line + "|");
try {
key = key.toLowerCase();
String lower_case = line.toLowerCase(... | 7 |
public boolean testDeplacement(Point p) {
boolean estDeplacable = true;
if (Math.abs(this.point.x - p.x) == 1) {
if (Math.abs(this.point.y - p.y) != 2) {
estDeplacable = false;
}
} else if (Math.abs(this.point.x - p.x) == 2) {
if (Math.abs(th... | 4 |
@SuppressWarnings("resource")
public PatientInformation(DataSource ds) {
while (true) {
// Ask for health care number from user.
System.out.println("Patient Information Update");
System.out.println("Enter 0 to go back.");
System.out.println("Please enter the patient's Health Care No.:");
Scanner i... | 3 |
protected static Ptg calcTBillYield( Ptg[] operands )
{
if( operands.length < 3 )
{
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
debugOperands( operands, "calcTBILLYIELD" );
try
{
GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getVa... | 5 |
public static void printMonsters(ArrayList<Monster> monsters){
ArrayList<String[]> monsterNames = new ArrayList<String[]>();
for (int i = 0; i < monsters.size(); i++){
monsterNames.add(new String[]{monsters.get(i).toString(), monsters.get(i).toPluralString()});
}
ArrayList<String[]> names = new Ar... | 7 |
public void direction() {
if (untouchable > 0) {
Dolphin dolphin = (Dolphin) getWorld().getObjects(Dolphin.class).get(0);
if (dolphin.direction == 0) {
setRotation(0);
}
else if (dolphin.direction == 1) {
setRotation(-45);
... | 9 |
@Override
public void salvar(Categoria categoria) throws LojaDLOException {
if (categoria.getId() != null){
Categoria categoriaFinal = dao.obter(categoria.getId());
categoriaFinal.setNome(categoria.getNome());
categoriaFinal.setDescricao(categoria.getDescricao());
... | 2 |
private void transfer() {
String amountStr = JOptionPane.showInputDialog(this, "Input an amount to transfer:", "Transfer", JOptionPane.QUESTION_MESSAGE);
if (amountStr == null) {
return;
}
try {
BigDecimal amount = FORMATTER.stringToValue(amountStr);
S... | 9 |
public static void updateBoundingBox(final WorldAxisAlignedBoundingBox theWorldAxisAlignedBoundingBox,
final Vector3f[] myVectors) {
if (myVectors == null || myVectors.length == 0) {
return;
}
/* get minimum and maximum */
_myTempMin... | 9 |
private String getExtension(String f) {
// get extension of a file
String ext = "";
int i = f.lastIndexOf('.');
if (i > 0 && i < f.length() - 1) {
ext = f.substring(i + 1);
}
return ext;
} | 2 |
private void reallyPlotPixel(int x, int y, boolean isBG, boolean isSpr) {
int val = 0; // background color
if (isBG) {
val = getBGPixelIndex(x, y);
} else {
// When BG rendering is off, we display color index 0
// unless the PPU is currently pointing at ... | 8 |
public void write_activated (Pipe pipe_)
{
// Skip activating if we're detaching this pipe
if (pipe != pipe_) {
assert (terminating_pipes.contains (pipe_));
return;
}
if (engine != null)
engine.activate_in ();
} | 2 |
public static void main(String[] args) {
if (args.length == 0) {
error("Not enough arguments: 0");
}
Set<String> commandList = new HashSet<>();
commandList.add("shutdown");
if (commandList.contains(args[0])) {
if (send(args[0])) {
System.out.println("SUCCESS!");
} else {
System.out.println(... | 3 |
final public void run()
{
// call the hook method to notify that the server is starting
serverStarted();
try
{
// Repeatedly waits for a new client connection, accepts it, and
// starts a new thread to handle data exchange.
while(!readyToStop)
{
try
{
... | 4 |
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException,
UnsupportedLookAndFeelException {
try {
UIManager
.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (UnsupportedLookAndFeelException ex) {
ex.printStackTrace();... | 4 |
private Object[] grabExternalVoxelData( int x, int y, int z )
{
Object[] data = new Object[ 5 ];
if ( region == null )
{
data[ 0 ] = null;
data[ 1 ] = Math.abs( x ) % LENGTH;
data[ 2 ] = Math.abs( y ) % LENGTH;
data[ 3 ] = Math.abs( z ) % LENGT... | 5 |
public List<Movie> meetCriteria(List<RelatedVote> relatedVotes, List<Integer> voted, List<Integer> notVoted){
RelatedVote rv1 = new RelatedVote();
RelatedVote rv2 = new RelatedVote();
List<Movie> l = new ArrayList<Movie>();
if(voted.size() < 2){
//se votou apenas em um pega os dois que tiveram mais votos q... | 8 |
private void createTetrominos(char name) {
switch(name){
case 'A':
nbVariante=2;
polyominos=new int[4][1];
polyominos[0][0]=1;
polyominos[1][0]=1;
polyominos[2][0]=1;
polyominos[3][0]=1;
couleur="-8355712";
break;
case 'B':
nbVariante=1;
polyominos=new int[2][2];
polyominos[0][0]... | 5 |
private void calcGNI() {
double GNI = 0;
for (int i = 0; i < _econ.size(); i++) {
GNI += _econ.get(i).get_GNI();
}
for (int i = 0; i < _cities.size(); i++) {
GNI += _cities.get(i).get_econ().get_GNI();
}
_GNI = GNI;
} | 2 |
private List<String> getInitUrls() {
String[] s = { "http://shop67109681.taobao.com",
"http://shop36505973.taobao.com",
"http://shop33082137.taobao.com",
"http://shop71710235.taobao.com" };
return Arrays.asList(s);
} | 0 |
public static int LevenshteinDistance(String s, String t) {
// degenerate cases
if (s == t)
return 0;
if (s.length() == 0)
return t.length();
if (t.length() == 0)
return s.length();
// create two work vectors of integer distances
int[] v0 = new int[t.length() + 1];
int[] v1 = new int[t.length()... | 8 |
@Override
public void validate() {
if (platform == null) {
addActionError("Please Select Platorm");
}
if (location == null) {
addActionError("Please Select Location");
}
if (android.equals("Please select")) {
addActionError("Please Sel... | 5 |
public static void main(String[] args) throws FileNotFoundException, IOException, Exception {
Conectar("preguntas_v2.db4o");
Preguntas.BorrarTodo(bd);
Preguntas.IntroducirDatos(bd);
System.out.println("*********************************************************");
System.out.printl... | 8 |
protected void sendMessages() throws Exception {
Message[] msgs=generateMessages(num_msgs);
CountDownLatch latch=new CountDownLatch(1);
AtomicInteger index=new AtomicInteger(0);
Sender[] senders=new Sender[num_senders];
for(int i=0; i < senders.length; i++) {
senders[... | 9 |
private void updateDisplay() {
int recursionDepth = spinnerModel.getNumber().intValue();
final List expansion = expander.expansionForLevel(recursionDepth);
progressBar.setMaximum(expansion.size() * 2);
imageDisplay.setImage(null);
Image renderImage = null;
final javax.swing.Timer t = new javax.swing.Timer(... | 1 |
public String getUsername() {
return username;
} | 0 |
public RreclassificationParametre(){
this.setNomBase(ConnexionBaseDonnees.getNomBase());
this.setPort(ConnexionBaseDonnees.getPort());
this.setNomUtilisateur(ConnexionBaseDonnees.getUser());
this.setMotDePasse(ConnexionBaseDonnees.getPswd());
this.setHote(ConnexionBaseDonnees.getHote());
tableaux.clear()... | 9 |
@Test
public void printWelcomeTest() throws Exception {
mockMvc.perform(get("/"))
.andExpect(status().isOk())
.andExpect(view().name("index"));
} | 0 |
void dfs(int v, int[] was1, int[] was2) {
++counter$0;
long counterBefore = tempCounter1;
if (true) {
if (was2[v] == 2 || was1[v] == 1) {
memCounter$1 = Math.max(tempCounter1, counterBefore);
{
tempCounter1 = counterBefore;
return;
}
}
was1[v] = 1;
tempCounter1 = tempCounter1 + 4... | 5 |
public SubjectType getSubjectType() {
if(subjectIndex==1) return FOREIGN_LANG;
if(subjectIndex<9) return STANDARD;
if(wahlfachType<3) {
return FOREIGN_LANG;
} else {
return NATURAL_SCIENCE;
}
} | 3 |
public void onStatStateChanged(Stat stat) {
if (stat.isNormalState())
logger.info(stat.getName() + " now is in normal state: " + stat.getStoredValueAsString());
else
logger.error(stat.getName() + ": " + stat.getStateDescription() + ": " + stat.getStoredValueAsString());
} | 1 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
int t = Integer.parseInt(in.readLine().trim());
for (int tt = 0; tt < t; tt++) {
int n = Integer.parseInt(in.readLine().trim());
if... | 7 |
public int getMultipleState (String name)
{
int k;
for (k = 0; k < Left.size(); k++)
{
IconBarElement i = (IconBarElement)Left.elementAt(k);
if (i.getName().equals(name) && i instanceof MultipleIcon) { return ((MultipleIcon)i)
.getSelected(); }
}
for (k = 0; k < Right.size(); k++)
{
IconBarEle... | 6 |
public static void LoadPluginAtBase(){
File base=new File(".");
File[] files=base.listFiles();
String[] regex={".+\\.yml",".+\\.smp"};
for(File f:files){
for(String regexs:regex){
if(f.getName().matches(regexs)){
try {
List<String>... | 5 |
@Override public void init() {
control = LcdBuilder.create()
.prefWidth(1280)
.prefHeight(400)
//.styleClass(Lcd.STYLE_CLASS_GREEN_DARKGREEN)
.foregroundShadowVisible(true)
... | 4 |
public Guid readGuid()
throws IOException {
final byte[] data = new byte[16]; // @todo resource this
for (int i = 0; i < 16; i++) {
final int currByte = read();
if (currByte == -1) {
throw new RuntimeException("Illegal end of stream");
}
data[i] = (byte) currByte;
}... | 3 |
public void activateEntry(String text, int pos) {
int current = 0;
for (Widget i = wdg().child; i != null; i = i.next) {
if (i instanceof TextEntry) {
current++;
if (current == pos) {
TextEntry te = (TextEntry) i;
if (text.equals(""))
te.activate(te.text);
else
te.activate(text... | 4 |
void saveAll() {
YamlConfiguration dc = new YamlConfiguration();
File sv = new File(getDataFolder(), "dragons.sav");
if (!sv.exists()) {
getDataFolder().mkdirs();
try {
sv.createNewFile();
} catch (IOException e) {
e.printStackT... | 7 |
@Override
public void run() {
for (Planet p : currentPlanets) {
if (p.getTag().equals("[=H=]")) {
restored.add(p);
}
}
for (Planet p : oldPlanets) {
if (p.getTag().equals("[=H=]")) {
restored.remove(p);
}
... | 4 |
public long getCompanyId() {
return companyId;
} | 0 |
public boolean savePhpbbUser(String user) throws SQLException,
ClassNotFoundException {
sqlClass();
sqlCon();
if (!customField.isEmpty()) {
query = "SELECT user_id FROM " + tablePref
+ "profile_fields_data WHERE pf_" + customField + "='"
+ user + "'";
ResultSet rs = SELECT(query);
if (rs.nex... | 4 |
@Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
position = buf.readUByte();
if (position < 63 || position > 255)
throw new RuntimeException("Forbidden value on position = " + position + ", it doesn't respect the following condition : position < 63 || posit... | 4 |
@Test
public void testServerClientConnectWithMessageQueue() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerClientConnectWithMessageQueue -----");
String server_hash = "";
String client_hash = "";
try {
server1.setUseMessageQueues(true);
} catch (TimeoutEx... | 4 |
public float getY(float x) {
return a * x * x + b * x + c;
} | 0 |
public void rotate()
{
switch(getDirection())
{
case "up":
setDirection("right");
break;
case "right":
setDirection("down");
break;
case "down":
setDirection("left");
break;
case "left":
setDirection("up");
break;
default:
System.out.println("rotate() is bugged");... | 4 |
public boolean equalsExpr(final Expr other) {
return (other != null) && (other instanceof ArrayLengthExpr)
&& ((ArrayLengthExpr) other).array.equalsExpr(array);
} | 2 |
public static BufferedImage getImage(final String name, final String URL, final String format) {
final File file = new File(Environment.getStorageDirectory(), name);
try {
if (!file.exists()) {
final BufferedImage image = ImageIO.read(new java.net.URL(URL));
I... | 2 |
public static double[] lsolve(double[][] A, double[] b) {
int N = b.length;
for (int p = 0; p < N; p++) {
// find pivot row and swap
int max = p;
for (int i = p + 1; i < N; i++) {
if (Math.abs(A[i][p]) > Math.abs(A[max][p])) {
ma... | 8 |
private boolean isUrl(String url) {
String regex = "((([A-Za-z]{3,9}:(?://)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:/[\\+~%/\\.\\w\\-_]*)?\\??(?:[\\-\\+=&;%@\\.\\w_]*)#?(?:[\\.\\!/\\\\\\w]*))?)";
if (Pattern.compile(regex).matcher(url).find()) return t... | 3 |
public static void taytaLomakkeenTiedot(JPanel lomake, EnumMap<Kentta, String> kentat) {
EnumMap<Kentta, String> lomakkeenSisalto = new EnumMap(Kentta.class);
Component[] komponentit = lomake.getComponents();
//näihin tallenetaan kirjalomakkeen comoboxissa valittu kenttä ja comboboxin nimi, jo... | 9 |
@Override
public void run() {
while(true){
synchronized(thread){
try {
JixelGame.setPaused(false);
thread.wait();
} catch (InterruptedException e) {
printErr("Console thread interrupted", e);
}
}
while (isRunning) {
JixelGame.setPaused(true);
if (!JixelGame.getKeyInput().i... | 5 |
private void update(){
if(isFullScreen != SettingsModel.getFullscreen()) {
if (SettingsModel.getFullscreen()){
this.fullScreen();
} else {
this.windowed();
}
this.setLocationRelativeTo(null);
this.setVisible(true);
this.isFullScreen = SettingsModel.getFullscreen();
}
} | 2 |
@Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (qName.equals("rowset")) {
if (currentAsset != null) {
stack.add(currentAsset);
currentAsset = null;
}
}
if (qName.equals("row")) {
currentAsset = new EveAsset<EveAsset<?>>()... | 6 |
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 SchlangenGlied getFirstGlied() {
if (previousGlied != null) {
return previousGlied.getFirstGlied();
} else {
return this;
}
} | 1 |
public void execute(){
Command commande = commandeCourante.commande;
commande.execute();
//Actualisation du modèle puis de la vue.
if(commande instanceof LirePlanCommand ){
zone = ((LirePlanCommand)commande).getZone();
Fenetre.getInstance().actualiserPlan... | 5 |
public static void main(String [] args) {
// Skapar ett TrafficSystem
// Utfor stegningen, anropar utskriftsmetoder
Random randomized = new Random();
Scanner sc = new Scanner(System.in);
System.out.println("The length of the car lanes will be randomized, but the user will set the range.");
... | 8 |
public static void trimBranch(Branch branch) {
// This does not normalize whitespace!
// The document tree is modified in place, but no nodes are removed.
if (trimmed.get(branch) != null) return;
trimmed.put(branch, branch);
List content = branch.content();
// trim leading whitespace
// NB: ... | 9 |
public String toString(){
String str = "if(" + condition.toString() + "){" + truePart.toString() + "}";
if(falsePart != null)
str+="else{" + falsePart.toString() + "}";
return str;
} | 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.