text stringlengths 14 410k | label int32 0 9 |
|---|---|
public String getScrambledWord(int idx) {
String c = WORD_LIST[idx];
Random rnd = new Random();
String[] a = new String[c.length()];
char f = 0;
String g = "";
String[] b = new String[100];
String e = "";
for(int i = 0; i<c.length();i++){
f=c.c... | 4 |
public int sizeOfWsFrameLength(byte type, int length) throws IOException {
// one bite for the type
int size = 1;
// Encode length.
int b1 = length >>> 28 & 0x7F;
int b2 = length >>> 14 & 0x7F;
int b3 = length >>> 7 & 0x7F;
if (b1 == 0) {
if (b2 == 0) {
if (b3 == 0) {
size += 1;
} else {
... | 3 |
public void paint ()
{
int i, j;
dl_atom dla = null;
dl_bond dlb = null;
Vector dlist = new Vector ();
if (showForces)
computeForces ();
for (i = 0; i < atomList.size (); i++)
{
dla = new dl_atom ((atom) atomList.elementAt(i), v);
dlist.addElement (dla);
}
for (i =... | 8 |
public void CheckCommands(String channel, String sender, String login, String hostname, String message)
{
if(!message.startsWith("!"))
return;
String params[] = message.split(" ");
String commandName = params[0].substring(1).toLowerCase();
... | 3 |
private static<T extends Comparable<? super T>> void merge(T[] data, T[] tmp, int leftPos, int rightPos, int rightEnd) {
int leftEnd = rightPos - 1;
int tmpPos = leftPos;
int leftPos2 = leftPos;
while (leftPos <= leftEnd && rightPos <= rightEnd) {
if (data[leftPos].compareTo(... | 7 |
public int minDepth(TreeNode root) {
if(root == null)
return 0;
deepTree(root,1);
return minDeep;
} | 1 |
public BagOfTiles() {
_tileBag = new ArrayList<Tile>();
_pointValueMap = new HashMap<Tile, Integer>();
String[] s = null;
@SuppressWarnings("resource")
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("Txt/Characters"));
} catch (FileNotFoundException e) {
// TODO Auto-genera... | 6 |
public CtClass getCtClass() {
if (resolved != null)
return resolved.getCtClass();
return Type.OBJECT.getCtClass();
} | 1 |
public FindReplaceResultsDialog() {
super(false, false, false, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT);
} | 0 |
public void collision(PhysicsCollisionEvent event) {
Spatial nodeA = event.getNodeA();
Spatial nodeB = event.getNodeB();
String nameA = nodeA.getName();
String nameB = nodeB.getName();
if(Meteor.NAME.equals(nameA) && "Me".equals(nameB)){
may... | 4 |
public void addEvent(Event event) {
events.add(event);
switch (event.getType()) {
case Event.BIRTH:
if (birth == null)
birth = event;
break;
case Event.BAPTISM:
if (baptism == null)
baptism = event;
break;
case Event.DEATH:
if (death == null)
death = event;
break;
... | 8 |
void printStdout(String text) {
if (text.lastIndexOf("%r") > 0) {
stdout.replaceRange(text.substring(text.lastIndexOf("%r") + 2),
stdout.getText().lastIndexOf('\n') + 1,
stdout.getText().length());
} else {
stdout.append(text);
... | 1 |
public void update() {
speedX = bg.getSpeedX() * 5;
tileX += speedX;
r.setBounds(tileX, tileY, 40, 40);
if (r.intersects(Robot.yellowRed) && type != 0) {
checkVerticalCollision(Robot.rectBody, Robot.rectLegs);
checkSideCollision(Robot.rectLeft, Robot.rectRight, Robot.footleft,
Robot.footright);
}
... | 2 |
public boolean Salvar(T obj) {
try{
//salva o objeto
manager.merge(obj);
return true;
}catch (Exception ex){
System.out.println(ex.getMessage());
return false;
}
} | 1 |
void setExampleWidgetBackground () {
if (colorAndFontTable == null) return; // user cannot change color/font on this tab
Control [] controls = getExampleControls ();
if (!instance.startup) {
for (int i = 0; i < controls.length; i++) {
controls[i].setBackground (backgroundColor);
}
}
// Set the backg... | 6 |
public void actionPerformed(ActionEvent e) {
MindMapNodeModel node = (MindMapNodeModel) mMindMapController
.getSelected();
// if something is wrong, abort.
if (mMindMapController.getMap() == null || node == null
|| node.isRoot()) {
mMindMapController.... | 9 |
public void subSolve(ArrayList<String[]> resArr, int[] res, int n, int x) {
if (x > n - 1) { // DONE
String[] tmp = new String[n];
for (int i = 0; i < n; i++) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < n; j++) {
sb.append(j == res[i] ? 'Q' : '.');
}
tmp[i] = sb.toString()... | 9 |
public boolean updateOneSymbol(Investment oneInvestment) {
boolean flag = false;
int type = getInvestType(oneInvestment.getSymbol());
String typeTable;
if (type == 0) {
typeTable = "stock";
} else {
typeTable = "mutual_fund";
}
Timestamp stamp = getLatestTimestamp(oneInvestment.getSymbol(), ty... | 9 |
public static String selectListParam(Map<String, Object> paramMap) throws SQLException{
@SuppressWarnings("unchecked")
java.util.Map<String,Object> sqlWhereMap = (Map<String, Object>) (paramMap.get("sqlWhereMap")==null ? "": paramMap.get("sqlWhereMap"));
BEGIN();
SELECT(User.COLUMNS);
FROM(User.T... | 3 |
public TreeNode sortedListToBST(ListNode head) {
int count = 0;
ListNode p = head;
while (p != null) {
count++;
p = p.next;
}
int[] num = new int[count];
p = head;
count = 0;
while (p != null) {
num[count] = p.val;
... | 3 |
public ArrayList<String> anagrams(String[] strs) {
HashMap<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();
ArrayList<String> result = new ArrayList<String>();
for (String str : strs) {
String min = toSmallest2(str);
ArrayList<String> tmp = map.g... | 4 |
public void render(int x, int y, Renderable rend){
if(rend == null){
ErrorHandler.nullRenderableInterface(this, "@ render (line ~90");
return;
}
for(int yy = 0; yy <= rend.getHeight(); yy++){
int yp = yy + y;
for(int xx = 0; xx <= rend.getWidth(); x++){
int xp = xx + x;
if(xp < 0 || xp > this... | 7 |
private void renderAttributes(PrintWriter out,
String labelName, Map<String, String> attributes) {
if ((labelName == null) && (attributes == null)) {
return;
}
out.print(" [ ");
if ((labelName == null) && (attributes != null)) {
labelName = attributes.get(... | 8 |
@Override
public void detectAndHandleCollisions(EntityGrid grid, CollisionHandler physics, float dt) {
nearestEntity = grid.getNearest(this);
if (physics.boxCollisionTest(this, nearestEntity)) {
if (nearestEntity instanceof PlayerEntity) {
handlePlayerIntersection((Pla... | 5 |
public static String getAppPath(String type) throws UnsupportedEncodingException{
String appRoot = "";
String path = "";
String slash = System.getProperty("file.separator");
String jpath = new File(SBStringUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getPath();
... | 5 |
public void setSelect(boolean select) {
selected = select;
} | 0 |
private void readInputAndUpdateCamera(Camera cam) {
int angle = mDemoKeyListener.getKeyDirectionAngle();
if (mDemoKeyListener.getMoveState()) {
switch(angle) {
case 0:
cam.x += 1;
break;
case ... | 9 |
public int maxSubArray(int[] A) {
int max = A[0];
int sum = 0;
for (int sell = 0; sell < A.length; sell++) {
sum = sum + A[sell];
max = Math.max(sum, max);
if (sum < 0)
sum = 0;
}
return max;
} | 2 |
public void doTestParsers() {
final int repeat = ConsoleMenu.getInt("How many Rows?", 1000);
final int numberOfCols = ConsoleMenu.getInt("How many columns?", 100);
final boolean qualif = ConsoleMenu.getBoolean("With qualifier?", true);
final StringBuffer aRow = new StringBuffer();
... | 4 |
public void testit( String argstr )
{
WorkBookHandle book = new WorkBookHandle();
// IMPORTANT PERFORMANCE SETTINGS!!!
book.setDupeStringMode( WorkBookHandle.SHAREDUPES );
book.setStringEncodingMode( WorkBookHandle.STRING_ENCODING_COMPRESSED );
WorkSheetHandle sheet = null;
try
{
sheet = book.get... | 5 |
private void createMenu() {
menuBar = new JMenuBar();
setJMenuBar(menuBar);
mnProject = new JMenu("Projekt");
menuBar.add(mnProject);
JMenuItem mntmNewProjectItem = new JMenuItem("Nowa gra");
mnProject.add(mntmNewProjectItem);
JMenuItem mntmSaveProjectItem = new JMenuItem("Zapisz grę");
mnProject.a... | 1 |
public void actionPerformed(ActionEvent ae) {
if (((MenuItem)ae.getSource()).equals(importMenuItem)) {
importAgents();
} else {
exportAgents();
}
} | 1 |
@Override
public void changedStatus(boolean running, boolean connected){
String icon;
if(running){
if(connected){
this.status.setText("Status: " + STATUS_CONNECTED);
icon = GREEN_ICON;
}else{
this.status.setText("Status: " + STATUS_WAITING);
icon = YELLOW_ICON;
}
toggleBtn.setText("D... | 5 |
private IntegerAggregate setDistance(Node start, Node finish, IntegerAggregate distance)
{
IntegerAggregate oldValue = distances.get(NodePair.get(start, finish));
boolean addDistance = oldValue == null || (oldValue.isNonterminating() && !distance.isNonterminating());
if (addDistance)
distances.put(... | 9 |
public int nextopt() {
int argChar = -1;
for (int counter = this.argindex; counter < this.args.length; ++counter) {
if ((args[counter] != null) && (args[counter].length() > 1)
&& (args[counter].charAt(0) == '-')) {
int charIndex = 0;
argChar = args[counter].charAt(1);
charIndex = this.opt... | 9 |
public synchronized static boolean updatePollAnswer(String pollID, String recipientID, String answerID) {
boolean retValu = false;
XStream xstream = new XStream(new DomDriver());
Polls[] allPolls = new Polls[0];
try {
File file = new File((String) Server.prop.get("pollFilePath"));
allPolls = (Polls[]) ... | 8 |
private void determineNextToken() {
if (dfa.isInReturnState())
executeReturn();
else if (dfa.didJumpOccur())
executeJump();
else
moveToNextToken();
} | 2 |
@Override
public void run() {
while(true){
if(Keyboard.isKeyPressed(KeyEvent.VK_SPACE)){if(energie > 0){energie -= 1;}}
if(energie < 100 && Keyboard.isKeyPressed(KeyEvent.VK_SPACE) == false){energie += 0.25;}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
... | 6 |
public static Lexical scanLexicon(String lexFilePath){
String line= "";
iIdentifier out;
PScanner scan = new PScanner(lexFilePath);
HashMap<String, CharacterC> chars = new HashMap<String, CharacterC>();
ArrayList<TokenC> tokens = new ArrayList<TokenC>();
int state = 0; //state 0 = first comments, 1 = i... | 9 |
public void makeColorKeyPixelsTransparent(BufferedImage img, Color colorKey)
{
// NOW MAKE ALL PIXELS WITH COLOR (64, 224, 224) TRANSPARENT
WritableRaster raster = img.getRaster();
int[] dummy = null;
for (int i = 0; i < raster.getWidth(); i++)
{
for (int j = 0; j... | 5 |
private void posizionaComponenti()
{
// Prepara il GroupLayout
this.remove(pannello); // Rimuove il pannello
pannello = new JPanel(); // Ne crea uno nuovo
GroupLayout layout = new GroupLayout(pannello); // Crea un nuovo Grou... | 9 |
public static void openFile(File file, Codec[] codecs) {
ParseException p = null;
for (int i = 0; i < codecs.length; i++) {
try {
Serializable object = codecs[i].decode(file, null);
if (openOrRead && !(object instanceof TuringMachine)) {
JOptionPane.showMessageDialog(null,
... | 7 |
public boolean satisfy(TagNode tagNode) {
if (tagNode != null ) {
for(Map.Entry<String, String>entry: tagNode.getAttributes().entrySet()) {
if ( (attNameRegex == null || attNameRegex.matcher(entry.getKey()).find()) && (attValueRegex == null || attValueRegex.matcher( entry.getValue() ... | 6 |
public void actionPerformed(java.awt.event.ActionEvent e) {
// Selecting an item results in an actioncommand "comboBoxChanged".
// We should be reacting to these since the drop down doesn't update immediately.
// Hitting enter results in an actioncommand "comboBoxEdited"
// But checking for isValid() tells us... | 3 |
public int strStr(String haystack, String needle) {
if (haystack == null || needle == null
|| needle.length() > haystack.length()) {
return -1;
}
if (haystack.isEmpty() && needle.isEmpty()) {
return 0;
} else if (needle.isEmpty()) {
return 0;
}
char[] sr = haystack.toCharArray();
char[] nd = ... | 9 |
public static int jump(int[] A) {
int len = A.length;
if(len < 2) {
return 0;
}
int currentPosition = 0;
int scope = A[0];
int count = 0;
while(currentPosition+scope < len-1) {
if(scope == 0) {
break;
}
int ma... | 7 |
public void mergeWithChunkOnEdge(Chunk chunk, Edge edge){
//get the reads
Read rightReadInThisChunk = this.reads.get(this.reads.size() - 1);
Read leftInOther = chunk.reads.get(0);
//establish a connection between them, reuse the edge
edge.setIdA(rightReadInThisChunk.getId());
edge.setIdB(leftInOther.getId()... | 4 |
private int getOption()
{
while (true)
{
try
{
System.out.print("\nEnter option: ");
int option = new Scanner(System.in).nextInt();
if (option >= 1 && option <= menuItems.length
|| option == EXIT_OPTION)
... | 5 |
public static void main(String[] args) {
OptionParser optionParser = new OptionParser() {
{
accepts(USE_CONFIG)
.withRequiredArg()
.ofType(boolean.class)
.defaultsTo(Defaults.USE_CONFIG)
.... | 4 |
public Builder addAllPerson(
java.lang.Iterable<? extends protocols.ChatProtocol.ChatPerson> values) {
if (personBuilder_ == null) {
ensurePersonIsMutable();
super.addAll(values, person_);
onChanged();
} else {
personBuilder_.addAllMessages(values);
... | 2 |
public boolean isConstant() {
if ((Options.options & Options.OPTION_ANON) == 0)
return super.isConstant();
ClassInfo clazz = getClassInfo();
InnerClassInfo outer = getOuterClassInfo(clazz);
ClassAnalyzer clazzAna = methodAnalyzer.getClassAnalyzer(clazz);
if (clazzAna != null && outer != null && outer.oute... | 6 |
private void displayItem()
{
Statement st = null;
ResultSet rs = null;
try {
st = custConn.getConnection().createStatement();
System.out.println(customerID);
String qry = "select * from ShoppingCart sc where sc.customer_ID = '" + customerID + "'";
rs = st.executeQuery(qry);
while(rs.next())
{
Sys... | 3 |
protected void stepBackward() {
CellElement currentCell;
switch (m_currentPhase) {
case PHASE_CALC_GRID:
m_currentStep--;
if (m_currentStep <= 0) {
stepZero();
return;
}
Point realD = getCoordsByStep(m_currentStep);
... | 9 |
static public Object deserializeArray(InputStream in, Class elemType, int length)
throws IOException
{
if (elemType==null)
throw new NullPointerException("elemType");
if (length<-1)
throw new IllegalArgumentException("length");
Object obj = deserialize(in);
Class cls = obj.getClass();
... | 6 |
public void render(int[] pixels, int offset, int row)
{
for (int yTile = yOffset >> 3; yTile <= (yOffset + height) >> 3; yTile++)
{
int yMin = yTile * 8 - yOffset;
int yMax = yMin + 8;
if (yMin < 0) yMin = 0;
if (yMax > height) yMax = height;
... | 8 |
public void setTwitter_user_name(String twitter_user_name) {
this.twitter_user_name = twitter_user_name;
} | 0 |
@Override
public void windowDeiconified(WindowEvent e)
{
} | 0 |
public static void main(String[] args) throws IOException {
MelonSearch search = MelonSearch.getinstance();
search.setOrder(MelonSearch.POPULAR);
search.setMaxSize(100);
search.setMinSize(1);
search.setSongName("괜찮아");
search.Search();
search.getSIDList();
... | 3 |
public static Rarity fromString(String s) throws IOException {
if (s.equalsIgnoreCase("basic")) {
return BASIC;
} else if (s.equalsIgnoreCase("fine")) {
return FINE;
} else if (s.equalsIgnoreCase("masterwork")) {
return MASTERWORK;
} else if (s.equalsIgnoreCase("rare")) {
return RARE;
} else if (s... | 7 |
private void fillStatement(PreparedStatement stmt, Object... params)
throws SQLException {
// check the parameter count, if we can
ParameterMetaData pmd = null;
if (!pmdKnownBroken) {
pmd = stmt.getParameterMetaData();
int stmtCount = pmd.getParameterCount();... | 8 |
protected HttpEntity toJsonEntity(final Object obj) {
String json = toJson(obj);
try {
return new JsonEntity(json);
} catch (Exception ex) {
Class clazz = null;
if (obj != null) {
clazz = obj.getClass();
}
throw new Ru... | 2 |
@Override
public void QuitNetGame() throws IOException {
int i, j;
if (eval(debugfile))
try {
debugfile.close();
} catch (IOException e) {
e.printStackTrace();
}
if (!netgame || !usergame || consoleplayer == -1 || demoplay... | 9 |
public boolean onCommand(Player player, String[] args) {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
if(player.hasPermission(getPermission())){
if(args.length >... | 5 |
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 fe... | 6 |
public boolean SEEK()
{
if(order.length()>0)
{
idx O = ( Cdx==null ? Idx :
( Cdx.I>=0 ? Cdx.Idx[ Cdx.I ] : null ));
if(O!=null)
{
PREPARE_KEY_FROM_DATA( O );
if(Idx!=null) Idx.seek(false);
else Cdx.seek(false);
go_recno( O.found || (O.sRecno>0) ? O.sRecno : reccount+1 ... | 7 |
private void construire(){
this.setLayout(new BorderLayout(0,0));
JPanel semaine = new JPanel(new GridLayout(1, 7));
JPanel mois = new JPanel(new GridLayout(6, 7));
String[] nomsJours = {"Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"};
// Affichage des ... | 6 |
public static boolean wordBreak(String s, Set<String> dict) {
boolean[] isWord = new boolean[s.length()+1];
isWord[0] = true;
for( int i = 0; i< s.length(); i++) {
// start from the matching word
if(!isWord[i]) {
continue;
}
fo... | 6 |
public void Start() {
if (Running)
return;
Running = true;
BanHandler.init();
es = new EventSystem(this);
startLogger();
Log("Starting..");
ch = new CommandHandler(this);
Group.Load(this);
p = Properties.init(this);
loadSystemProperties();
pm = new PacketManager(this);
pm.StartReading();
Lo... | 8 |
public static void load() {
// Create the connection to
ExecutorService pool = Executors.newFixedThreadPool(1);
Thread th = new Thread() {
public void run() {
int i = 0;
while (i++ < 10) {
try {
sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
... | 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 |
void addIfTestMethod(Method m) {
if(m.getAnnotation(Test.class) == null)
return;
if(!(m.getReturnType().equals(boolean.class) ||
m.getReturnType().equals(void.class)))
throw new RuntimeException("@Test method" +
" must return boolean or void");
m.setAccessible(true)... | 3 |
private String getDescription() {
String desc = "@MongoCount(" + this.getParsedShell().getOriginalExpression() + ")";
if (!StringUtils.isEmpty(globalCollectionName)) {
desc = ",@MongoCollection(" + globalCollectionName + ")";
}
return desc;
} | 1 |
private int getMachineIndexBySelectedRow(JTable table){
InputTableModel model = (InputTableModel) table.getModel();
int row = table.getSelectedRow();
if(row < 0) return -1;
String machineFileName = (String)model.getValueAt(row, 0);
return getMachineIndexByName(machineFileName);
} | 1 |
public boolean distributionStrategy(int[] bowl) {
predictDistribution();
double expectedScore = calculateExpectedScore();
// Take a bowl greater than your expected score based on the distribution
if (bowlScore(bowl) > expectedScore + .05 * expectedScore)
return true;
... | 1 |
public static int[][] textToGrid(String text) {
int[] nums = stringToInts(text);
if (nums.length != SIZE*SIZE) {
throw new RuntimeException("Needed 81 numbers, but got:" + nums.length);
}
int[][] result = new int[SIZE][SIZE];
int count = 0;
for (int row = 0; row<SIZE; row++) {
for (int col=0; col<S... | 3 |
public static Storeable deserialize(Table table, String value) {
if (value == null) {
return null;
}
Storeable result = new MyStoreable(table);
JsonArray array = (new JsonParser().parse(value)).getAsJsonArray();
for (Integer i = 0; i < array.size(); ++i) {
... | 2 |
protected Environment getEnvironment() {
return environment;
} | 0 |
@Override
public Line getNextFromTitle() {
Title title = (Title) this.getParent();
if (title.getParent().isVisible()) {
if (title.getParent().getTextIntro().getLineNb() > 0) {
return title.getParent().getTextIntro().getFirstLine();
}
else if(title.getParent().getNextSection() != null){
return... | 4 |
private static Connection getDBConnection() {
Connection dbConnection = null;
url = "jdbc:oracle:thin:@" + server + ":" + port + ":" + sid;
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
... | 2 |
public void Tick()
{
//MOVEMENT
boolean[][]RoomUnitMap = new boolean[this.GrabModel().MapSizeX][this.GrabModel().MapSizeY];
for(Session mSession : this.GrabParty().values())
{
if(mSession.GrabActor().NeedsPathChange) //Give them .5 of a second to get ready for their new path
{
Collection<byte[]> Pa... | 7 |
public String retrieveOrderInfo(String supName,int orderID) throws SQLException{
String orderInfo = null;
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement) databaseConnector.createStatement();
SQLQuery="SELECT orderInfo FROM familydoct... | 4 |
public int[] getRange()
{
return myRange;
} | 0 |
public void createMemento() {
c.saveMemento(new Memento(state));
} | 0 |
public Coordinate move(String commands) {
move:
for(int i = 0; i < commands.length(); i++) {
Coordinate newPosition;
switch(commands.charAt(i)) {
case 'l':
turnLeft();
break;
case 'r':
turnRight();
break;
case 'f':
newPosition = grid.getNewPosition(currentPosition, ... | 7 |
public static void main (String[] args)
{
if (args.length != 1) {
System.err.println("Uso: java LectorMatrizXML <archivo>");
System.exit(1);
}
try {
LectorMatrizXML lector = new LectorMatrizXML(args[0]);
int i;
System.out.println("Default "+l... | 5 |
@Override
public void metaData(String[] args) {
MetaData.main(args);
} | 0 |
public void propertyChange(PropertyChangeEvent evt) {
if(evt.getPropertyName().equals("money")) {
update();
}
} | 1 |
public int getPartsSize(){
return parts.size();
} | 0 |
private TimeSerieRange findBiggestTimeSerieRange() {
if (this.timeSeriesConfigs != null) {
TimeSerieRange result = new TimeSerieRange();
if (this.timeSeriesConfigs.size() >= 1) {
TimeSerieRange tscRange = this.timeSeriesConfigs.get(0).getTimeSerie().getRange();
result.setMinX(tscRange.getMinX());
re... | 7 |
private int getMMC(int valor1, int valor2) {
int n = 2;
int resultado = 1;
valor1 = valor1 < 0 ? valor1*-1: valor1;
valor2 = valor2 < 0 ? valor2*-1: valor2;
while(valor1 != 1 || valor2 != 1){
while(valor1 % n != 0 && valor2 % n != 0){
n++;
}
if(valor1 % n == 0){
valor1 = valor1 / n;
}
... | 8 |
@Test
public void scale_test() {
try{
double [][]mat1= {{1.0,2.0}, {3.0,1.0}};
double factor= 2;
double[][]result = Matrix.scale(mat1, factor);
double exp[][]={{2.0,4.0},{6.0,2.0}};
Assert.assertArrayEquals(exp, result);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not ye... | 1 |
private boolean backtracking(ArrayList<Clausula> clau, Quadricula qu, int j) {
if (clau.size() == j) { // Tenim una solucio
return true;
} else {
Clausula c = clau.get(j);
for (ClausulaNom cn : c.getClausula()) {
Element e = new Element();
... | 8 |
void parseFields()
{
int ndx = 0;
for (Field field : actualClass.getDeclaredFields()) {
if (!Modifier.isStatic(field.getModifiers())) {
JsonProperty jsonProperty = field.getAnnotation(JsonProperty.class);
int hash = (jsonProperty != null ? jsonProperty.name().hashCode() :... | 9 |
private void MovieTitleRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MovieTitleRemoveButtonActionPerformed
String delMovie = MovieTitleRTextField.getText();
out.println("4!" + delMovie);
try {
String delRecord = in.readLine();
if (delRecor... | 2 |
public void setVisible(boolean isVisible) {
if (!isVisible && superGroup != null) {
superGroup.setNewGroupBounds();
}
this.isVisible = isVisible;
} | 2 |
private String getStartButtonTooltips(){
StringBuffer sb = new StringBuffer();
if(isGameReady()){
sb.append( "Start the Scrabble Game with: ");
for(Player p : players){
sb.append(p.getName()+" ");
}
}
else{
sb.append("Invalid player number. Must have 2 - 4 players.");
if(players == null || pl... | 5 |
public ArrayList<Object> upperOutliersAnscombe_as_double(double constant) {
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
upperOutlierDetails = upperOutliersAnscombeAsArrayList(dd, constant);
break;
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
ArrayList<Object> ret ... | 3 |
public short getShort(Object key) {
Number n = get(key);
if (n == null) {
return (short) 0;
}
return n.shortValue();
} | 1 |
public final void setRootAction(Action a) {
if(a == null)
rootAction = defaultRootAction;
else
rootAction = a;
} | 1 |
public List<IPEntry> getIPEntries(String s) {
List<IPEntry> ret = new ArrayList<IPEntry>();
try {
// 映射IP信息文件到内存中
if (mbb == null) {
FileChannel fc = ipFile.getChannel();
mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, ipFile.length());
mbb.order(ByteOrder.LITTLE_ENDIAN);
}
int endOffset = (... | 6 |
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.