method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fa212fee-fe31-4da2-86a6-e5651bce38b1 | 0 | public Set<Being> getSurroundingBeings() {
return Supervisor.getSupervisor().getSurroundingBeings(this, constStats.get(StatType.C_VISION_RADIUS).getValue());
} |
4ed1b989-cc6f-4d47-b6de-42907fa0dd6d | 9 | public boolean updateStatment(String stat) {
StringTokenizer str = new StringTokenizer(stat);
if (!str.hasMoreTokens())
return false;
String firstWord = str.nextToken();
if (firstWord.equalsIgnoreCase("update")) {
if (!str.hasMoreTokens())
return false;
tableName = str.nextToken();
if (!str.h... |
9c6b4f62-91bd-4e4d-b283-d50fccab96f7 | 2 | @Override
public String valueToString(Object value) throws ParseException {
WeightValue weight = (WeightValue) value;
if (mBlankOnZero && weight.getValue() == 0) {
return ""; //$NON-NLS-1$
}
return weight.toString();
} |
bc915840-f7ca-4de8-8e7e-f4b8fd0543af | 6 | private Token scanAnchor (Token tok) {
char indicator = peek();
String name = indicator == '*' ? "alias" : "anchor";
forward();
int length = 0;
int chunk_size = 16;
Matcher m = null;
for (;;) {
String chunk = prefix(chunk_size);
if ((m = NON_ALPHA.matcher(chunk)).find()) break;
chunk_size += 16;
... |
aef31ee5-a406-4b98-a1d3-22da9014aad9 | 7 | public static void main(String[] args) {
int iterations = 0;
int result = 0;
List<Integer> duplicates = new ArrayList<>();
for (int i = 100; i < 1000; i++) {
for (int j = 100; j < 1000; j++) {
if (!duplicates.isEmpty() && i < duplicates.get(duplicates.size() ... |
79c302bc-de53-4c98-8538-bae0fbb05941 | 8 | public static String analystEstimates(String stock) {
int counting = 0;
// Year Ago EPS //after this key substring to Revenue Est
String httpdata = getHtml(yahoobase + "/ae?s=" + stock);
String chop = "";
if (httpdata.contains("Earnings Est")
&& httpdata.contains("Currency in USD")) {
chop = httpdata
... |
925b136f-da40-4794-b612-61d16532f7f9 | 4 | protected boolean addAppointment(Appointment a) {
if (appointmentList.isEmpty() == false) {
boolean canAdd = true;
for (Appointment app : appointmentList) {
if (app.getPeriod().intersectionWith(a.getPeriod()) != null) {
canAdd = false;
... |
07893f22-3c1d-426a-acb7-a8eccf784a3b | 3 | protected void move(Vector3d v3d) {
if (!isCollision(v3d)) {
tg.getTransform(t3d);
Transform3D tt3d = new Transform3D();
tt3d.setTranslation(v3d);
t3d.mul(tt3d);
tg.setTransform(t3d);
} else {
ApplicationBundle ab = (ApplicationBundle) s3d.getUserData();
if (ab != null) {
CollisionBehavior ... |
d0f49dde-0345-4692-b74a-5b4477b14109 | 8 | void addEdgeMaxSize(String a, String b, HashMap<String, Integer> protid, int maxSize) {
if (a == null ? b == null : a.equals(b)) { // there cannot be an edge to itself
// System.err.println("Lalalala lololo " + a + " " + b);
return;
}
if (protid.containsK... |
4e877136-0a0e-4da4-8a58-c59397b02267 | 1 | public String[] Recorrer(int n,ListaSimpleProceso lstProcesos){
//int n=cantProc.sys_productores;
lstProcesos.Imprimir();
NodosListaProceso aux=lstProcesos.PrimerNodo;
int i=0;
String[]procesos=new String[n];
while (aux!=null){
procesos[i]=aux.nombreProceso;
... |
76eafee0-95a8-4c52-b6a3-18841bb24856 | 4 | public boolean accept(File file) {
if (file.isDirectory()) {
return true;
} else {
String path = file.getAbsolutePath().toLowerCase();
for (int i = 0, n = extensions.length; i < n; i++) {
String extension = extensions[i];
if ((path.endsWith(extension) && (path.charAt(pat... |
073cb724-f1be-4c7b-ba9a-32ff58957f81 | 1 | public short getShort(){
try{
return Short.parseShort( value );
}
catch( NumberFormatException ex ){
throw new XException( ex );
}
} |
94504191-5ccb-4c18-ad4f-178db6277cec | 8 | public String description() {
StringBuilder sb = new StringBuilder();
if (isCombo() ) {
int i = 0;
for (NewComboLeg leg : m_comboLegs) {
if (i++ > 0) {
sb.append( "/");
}
sb.append( leg.toString() );
}
}
else {
sb.append( m_symbol);
app( sb, m_secType);
app( sb, m_exchange);
... |
95d9de23-b19b-4516-a889-79529221a4a6 | 7 | final public ParseModifierGroup modifierGroup() throws ParseException {
ParseModifierGroup modifierGroup = new ParseModifierGroup(); Token ident;
jj_consume_token(MODIFIERGROUP);
ident = jj_consume_token(IDENT);
jj_consume_token(56);
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_nt... |
378578ee-1cec-408a-a8b4-55e04769d8cb | 1 | public void addAttribute(AttributeInfo info) {
if (attribute == null)
attribute = new LinkedList();
AttributeInfo.remove(attribute, info.getName());
attribute.add(info);
} |
e7645726-d349-4823-a112-1534a37bd9fa | 7 | private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... |
7570ec8d-e2f7-4fe3-ab62-f4e41a3bbf2d | 0 | public List findByUniversity(Object university) {
return findByProperty(UNIVERSITY, university);
} |
6c9e90e9-a8fc-4eb8-8ab3-248761ece9ab | 0 | public void tick()
{
unit.tick();
} |
3fa5245c-4b80-4954-8bdc-fc9c58e62e33 | 6 | private void initializeGame() {
players = new Player[numPlayers];
firstPlayerIndex = (int) (numPlayers * Math.random());
index = firstPlayerIndex;
playerPnlHash.clear();
initGUI();
pushScreen(gameScreen);
map = new Map(this, useEpicMap);
int half = (int) Math.ceil(numPlayers / 2.0);
for (int ... |
f682fb9d-af0d-488f-aa3f-b9227c773a31 | 3 | public String getComment(int index) {
if (comments == null || index < 0 || index >= comments.size()) {
throw new IllegalArgumentException("Not a valid comment index: " + index);
}
return (String)comments.elementAt(index);
} |
9e5d5b5a-4359-4b3b-a845-a85b0cbc2f98 | 2 | public List<Server> load() {
List<Server> list = new ArrayList<>();
Match servers = rootElement.children();
for ( Match server : servers.each() ) {
Server s = new Server();
List<Match> attributes = server.children().each();
for (Match attr : attributes)
... |
7c1509b5-b1cd-48c5-98b1-19ab13f3f73b | 8 | public static void main(String[] args) throws Throwable{
char[][] mat=new char[][]{
/*"1234567890-=".toCharArray(),*/
"qwertyuiop[]\\".toCharArray(),
"asdfghjkl;'".toCharArray(),
"zxcvbnm,./".toCharArray()
};
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuilder s... |
0c9b2231-5757-4a22-89ae-4d8632dd5aaa | 8 | public int evalMove(Move m, State s, int depth, int alpha, int beta) {
int a = alpha;
int b = beta;
count++;
if (depth == 0) { // cutting off search -> evaluate resulting state
return evalState(s.tryMove(m));
} else { // minimax-search
// update the state
State newstate = s.tryMove(m);
... |
74f03f81-7021-4f7f-abce-c1955e4f68f7 | 5 | private void actualizarTabla() {
actualizarPagina();
List<Sesion> list = new HibernateTransaction<List<Sesion>>() {
@Override
public List<Sesion> run() {
Criteria cQuery = session.createCriteria(Sesion.class);
cQuery.add(Restrictions.gt("entradas_... |
8aff79d0-9204-4f61-b23f-9586cfbf5c52 | 2 | public static void main(String[] args) {
Random gen = new Random();
Biome[] biomes = new Biome[10];
for(int i = 0; i < biomes.length; i++) {
biomes[i] = new Biome(gen.nextInt(Arrays.biomes.length), (gen.nextInt(10) + 1));
}
int i = 0;
for(Biome biome: biomes) {
System.out.println("\n" + i + " L... |
468c5606-4191-4489-b714-1dd5ea173f70 | 3 | private StdImage createColumnDragImage(TreeColumn column) {
Graphics2D gc = null;
StdImage off2 = null;
StdImage off1 = createImage();
try {
int width = column.getWidth();
int height = getHeight();
off2 = StdImage.createTransparent(getGraphicsConfiguration(), width, height);
gc = off2.getGraphics();... |
d8f328aa-7279-47c5-8e68-571ac217d0b9 | 8 | public static void release(Object... releasables)
{
for (Object obj : releasables)
{
if (obj != null)
{
try
{
if (obj instanceof ServerSocket)
{
((ServerSocket)obj).close();
}
else if (obj instanceof Socket)
{
((Socket)obj).close();
}
else if (obj instan... |
87c22e46-2a9c-4a8a-8a52-7a704789f929 | 8 | private void executeCommand(final String text) {
final InputStream procInput;
new Thread(new Runnable() {
public void run() {
try {
temp_files_to_clean_up.add(buffer_file.getCanonicalPath());
PrintWriter out = new PrintWriter(new FileO... |
0deb8f4a-3ff9-4257-ab2b-e48cdb8283dc | 7 | public static void main(String[] args) {
int first = (int) (Math.random() * 10);
int second = (int) (Math.random() * 10);
while (first == second) {
second = (int) (Math.random()) * 10;
}
Scanner input = new Scanner(System.in);
System.out.print("Enter the two ... |
3de9a13d-b55b-4a3f-bf0f-e17f7406cc79 | 3 | public boolean canReach(TreeNode root, TreeNode n) {
if (root == null)
return false;
if (root == n)
return true;
return canReach(root.left, n) || canReach(root.right, n);
} |
89505038-7287-4502-a4ae-a8776c26578d | 2 | @Override
public void clearMemory() { //To reset memory contents when loading a new program
for (int i = 0; i < 100; i++) { //Resets each non-null address to null, effectively clearing memory contents
if (MEMORY[i] != null) {
MEMORY[i] = null;
}
else {
break;
}
}
} |
395d6404-b554-4d97-92f8-1410d8b6606d | 7 | private void ensureCapacity(int minimalCapacity)
{
int required = minimalCapacity - FIELDS_STORE_SIZE;
if (required <= 0) throw new IllegalArgumentException();
if (data == null) {
int alloc = FIELDS_STORE_SIZE * 2;
if (alloc < required) {
alloc = requi... |
d8bcb12d-53fe-4c98-96b4-91900771d254 | 4 | public int minusDMLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) )
return -1;
if( optInTimePeriod > 1 )
return optInTimePeriod + (this.unsta... |
18411c06-e4ef-4d86-bd1f-f86bbab94438 | 9 | public String getPrivilegesString() {
ArrayList<String> privs = new ArrayList<String>();
int r = privileges;
if (r == 0) {
privs.add("(NONE)");
} else {
if ((r & (1<<7)) != 0) {
r &= ~(1<<7);
privs.add("Security Domain");
}
if ((r & (1<<4)) != 0) {
r &= ~(1<<4);
privs.add("Card... |
80e72c2a-78e8-40d3-8168-11ef28d780d7 | 1 | public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() {
@Override
public boolean preShutdown(IWorkbench workbench, boolean forced) {
if (StopGruntTaskAction.p != null)
StopGruntTaskA... |
80e7cee5-ecf0-4017-99e3-1886c68e0e14 | 4 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int v = in.nextInt();
int[] f = new int[3002];
while(n-->0){
int a = in.nextInt();
int b = in.nextInt();
f[a] += b;
}
int s = 0;
int rem = 0;
for(int i=1;i<=3001;i++){
int round =... |
438b3e46-07a6-4544-a8d9-cde64ce5b01f | 7 | public boolean isMatchRec(String s, String p) {
if(p.isEmpty()) return s.isEmpty();
if(s.length() >= 1 && (s.charAt(0) == p.charAt(0) || p.charAt(0) == '?')){
if(p.startsWith(p.charAt(0) + "*")){
return isMatch(s.substring(1), p) || isMatch(s, p.substring(2));
}e... |
b9cf4991-40cb-45cf-a789-18eb3b10b761 | 2 | public static ThreadPool getInstance(){
if(thrdPlInst == null){
synchronized(ThreadPool.class){
if(thrdPlInst == null){
thrdPlInst = new ThreadPool();
}
}
}
return thrdPlInst;
} |
70aa171d-3547-4ae1-b61c-6d2d9836b724 | 4 | public void act() throws GameException
{
if(God.isKeyDown(KeyEvent.VK_UP))
move(Direction.TOP);
else if(God.isKeyDown(KeyEvent.VK_RIGHT))
move(Direction.RIGHT);
else if(God.isKeyDown(KeyEvent.VK_LEFT))
move(Direction.LEFT);
else if(God.isKeyDown(KeyEvent.VK_DOWN))
move(Direction.BOTTOM);
else mov... |
8ab495a1-4494-4d4b-9b93-6d24d2f5c8b6 | 3 | public void run(){
System.out.println("Producer run begin");
while( CurrPro < MaxPro ){
synchronized (s) {
if( s.list.size() < s.size ){
String str = String.valueOf(Math.random());
System.out.println(Thread.currentThread().getName() + "Add "+ this.CurrPro + " : " + str);
s.list.add( str );
... |
366bd322-434a-4b07-9b50-a21005cf01bc | 3 | public static boolean valida_nombre(String nombre) {
String nombre_pat = "^([A-Za-zñáéíóú])+([\\s]{1}[A-Za-zñáéíóú]+)?([\\s]{1}[A-Za-zñáéíóú]+)?$"; //Nombres de 2 hasta hasta 70
if (nombre == null) {
return false;
}
return nombre.matches(nombre_pat) && nombre.length() >= 2... |
95450e80-0129-43e7-b632-335fbcc67bec | 7 | void setAttributes(AttributeSet a) {
attributes = new SimpleAttributeSet();
/***************************************************************************************************************
* IMPORTANT: remove component and icon attributes from the MutableAttributeSet. * This does not affect this
* function ... |
e1c27e0c-f957-4ea6-b71c-288405a09df2 | 1 | public static User createUser(String name, String username, String password) {
User user = userManager.getUser(username);
if (user == null) {
user = new User();
user.setName(name);
user.setUsername(username);
user.setPassword(password);
userManager.insertUser(user);
return user;
}
return null;... |
300b6e44-bc33-460c-94bb-fcb459b85298 | 9 | public static void input(){
xVel = 0;
//Whatever the heck we do here...
if ((Keyboard.isKeyDown(Keyboard.KEY_W) && ((hasWallBelow())||(dJump >= 8 && !hasDJumped && hasBeenReleased)))){
yVel=usefulNumbers.jumpConstant;
if (dJump >= 8 && !hasDJumped)
hasDJumped = true;
}
if (Keyboard.isKeyDown(Keyboar... |
1396518c-76ad-47f2-996d-6d0fcf7fb00e | 5 | public byte[] get(String name) {
byte buf[] = null;
int hash = 0;
name = name.toUpperCase();
for (int i = 0; i < name.length(); i++) {
hash = hash * 61 + name.charAt(i) - 32;
}
for (int i = 0; i < totalFiles; i++) {
if (identifiers[i] == hash) {
if (buf == null) {
buf = new byte[decompressedS... |
22da3b04-b7e6-4d4c-93d8-707a23b17850 | 3 | private Set<String> loadAndroidCallbacks() throws IOException {
Set<String> androidCallbacks = new HashSet<String>();
BufferedReader rdr = null;
try {
rdr = new BufferedReader(new FileReader("AndroidCallbacks.txt"));
String line;
while ((line = rdr.readLine()) != null)
if (!line.isEmpty())
andro... |
ae066ebd-6fc4-4a8f-b05f-cd31ce8ae82b | 2 | private void delete(int oximaId,int index){
/*
* diagrafei to epilegmeno oxima
*/
String query="delete from oximata where id=?";
try {
con.pS=con.conn.prepareStatement(query);
con.pS.setInt(1, oximaId);
} catch (SQLException e) {
e.printStackTrace();
}
if(con.makeQuery(query)){
JOptionPane... |
2d9b3aea-0d5e-4d3a-8f3f-bb4a028b2bf2 | 1 | public Doctor getDoctor(int index){
try{
return doctor.get(index);
} catch (IndexOutOfBoundsException e){
}
return null;
} |
1aafc002-0c8f-4486-9966-130918bf0443 | 5 | @Override
public void doAction(String choice) {
switch (choice) {
case "G": // display the game goal screen
HelpGoalView goalView = new HelpGoalView();
goalView.displayGameGoalView();
break;
case "M": // display the move help screen
... |
c4c456e9-bf86-4ff5-b6f2-c32cef60194a | 2 | public HashSet<String> connectTo(String word) {
char[] wordChars = word.toCharArray();
HashSet<String> result = new HashSet<String>();
for (int i = 0; i < wordChars.length; i++) {
char before = wordChars[i];
wordChars[i] = (char) 0;
Str... |
f9673646-6366-46e1-a910-3eff567dc44a | 4 | Pizza createPizza(String item) {
if (item.equals("cheese")) {
return new NYStyleCheesePizza();
} else if (item.equals("veggie")) {
return new NYStyleVeggiePizza();
} else if (item.equals("clam")) {
return new NYStyleClamPizza();
} else if (item.equals("pepperoni")) {
return new NYStylePepperoniPizza... |
5645af78-069d-4e9d-962a-9d5a5e3fd140 | 6 | @SuppressWarnings("unchecked")
public List<List<Gate>> getLayersOfGates(List<Gate> gates) {
List<List<Gate>> layersOfGates = new ArrayList<List<Gate>>();
int totalNumberOfInputs = circuitParser.getTotalNumberOfInputs();
/*
* Loop to run through each list in our MultiMap, first runs through all
* gates wit... |
8871c8ae-2088-4d11-999a-82fe72be29d9 | 6 | public void setGridSize(int rows, int cols) {
if (rows == this.rows && cols == this.cols) {
return;
}
SoundCell[][] newCells = new SoundCell[rows][cols];
for (int r = 0; r < Math.min(rows, this.rows); r++) {
newCells[r] = Arrays.copyOf(cells[r], cols);
}... |
317f61b2-f274-4cd0-acc7-df288d81089f | 7 | public static void main(String[] args) {
prop = new Properties();
try {
InputStream propIn = new FileInputStream("properties/ga-binPacking.properties");
prop.load(propIn);
} catch (IOException e) {
e.printStackTrace();
}
maxGen = Integer.pars... |
969fdf5c-e519-4eef-8d3e-eae1e7dfc4fe | 8 | private void addSearchPanel(JPanel frame) {
searchPanel = new JPanel();
wordField = new JTextField(50);
wordField.getAccessibleContext().setAccessibleDescription(
"Enter the word to search here");
wordField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) ... |
e7de966f-4cde-4432-bc09-73bf9b9d6df8 | 0 | public JTextField getyMinTextField() {
return yMinTextField;
} |
8cd4dad9-d7f2-4e24-9c59-5de46b9873cf | 1 | public List<Record> getTable() {
return table==null? new ArrayList<Record>():table;
} |
d1f55037-9c9e-48aa-b088-709f3c515253 | 6 | public Mixer.Info getMixerInfo(String mixerName){
Mixer.Info mixers[]=AudioSystem.getMixerInfo();
audioDebugDump("getMixerInfo() : Hunting for "+mixerName);
// Iterate through the mixers and display TargetLines
int i;
for (i=0;i<mixers.length;i++){
Mixer m=AudioSystem.getMixer(mixers[i]);
if (debugAudio... |
5e7dd685-2a48-483d-bf90-7f92fdf57304 | 4 | public void play() {
boolean playListStopping = false;
if(gamePlayList != null) {
playListStopping = gamePlayList.getStopping();
}
if(!playListStopping) {
if(playerThread != null && player != null) {
player.stop();
}
player ... |
c0b95c36-028f-48d6-97ce-116b3fafda8a | 4 | public static Matrix add(Matrix matrix1, Matrix matrix2) throws IllegalDimensionException {
if (matrix1.getNcols() != matrix2.getNcols() || matrix1.getNrows() != matrix2.getNrows())
throw new IllegalDimensionException("Two matrices should be the same dimension.");
Matrix sumMatrix = new Matr... |
c92b86e0-7dd0-4bd7-ac5b-d5d72243a90d | 2 | public RealData(String para) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 10; i++) {
sb.append(para);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
result = sb.toString();
} |
88429021-607e-445e-bb05-98e19194b351 | 7 | void replaceChild (Node oldChild, Node newChild)
{
if (_occursFixedOrVariable_ == oldChild)
{
setOccursFixedOrVariable ((POccursFixedOrVariable) newChild);
return;
}
for (ListIterator i = _ascendingOrDescendingKeyPhrase_.listIterator ();
i.ha... |
9c9177ee-2362-4bf3-a7ae-ca036ccbaedf | 7 | public void fade(Graphics g)
{
if(fadeActive == true)
{
//System.out.println(count);
Image fadeFrame = fade[count];
g.drawImage(fadeFrame,0,0,this);
if(count == 9)
{
toggle = true;
if(changeScreen == true)
{
if(screenUp == true)
{
screenNumber++;
changeScreen... |
d9c67fd6-b199-44dd-87ad-96ef6a7ffdee | 4 | public boolean replace(long key, long value, long newValue) {
int bucketNumber = getBucketNumber(key);
if( bucketNumber == 0 ) return false; // Bucket not found
long bucket[] = buckets[bucketNumber];
if( bucket == null ) return false; // Null bucket
int len = bucketFirstAvailable[bucketNumber];
for( int... |
83034ba2-84d9-4c4f-a5a4-398dc66c6e23 | 5 | * @Post: no changes
* @Return: whether or not this point is under attack by an enemy pawn
*/
private boolean pawnCanAttack(Point pointToCheck) {
ArrayList<Point> possiblePawnLocations= new ArrayList<Point>();
//puts the appropriate positions a pawn could attack from into the list
if(isWhitesTurn())
{
p... |
bd29e4bb-1771-4512-a48c-866e83a05019 | 1 | public Asteroid buildAsteroid() {
if (target.getClass() == InhabitedPlanet.class) {
dangerousToMankind = true;
} else {
dangerousToMankind = false;
}
Asteroid returnedAsteroid = new Asteroid(id,
name,
... |
a0b8909b-60e1-4986-8d2e-1b66d03ae829 | 3 | public static void totalPay(String empName, double basePay, int hoursWorked) {
if(basePay < 8.00) {
System.out.println("Base pay too low, at least $8.00 per hour.");
return;
}
if(hoursWorked > 60) {
System.out.println("Too much hours worked, at most 60 hours.");
return;
}
double totPayed = 0.00... |
cb170c30-a28f-48eb-96fa-87221d1e58a0 | 0 | public Filter nor( Filter other )
{
return new Not( or( other ) );
} |
45f7068f-9c81-4fd1-9fa3-a8db7028b569 | 9 | @Override
public EntityMetadata deserialize(DataInputStream is) throws IOException {
EntityMetadata metaData = new EntityMetadata();
int keyAndType = is.readUnsignedByte();
while (keyAndType != 127) {
int index = keyAndType & 0x1f;
int type = keyAndType >> 5;
Object value = null;
s... |
8cfc4fcf-1ca3-425d-a84a-475dd62a19ab | 3 | public double[][] solveOde(ODESystem sis, double[] initialCondition, double lastX, double step) {
double x = initialCondition[0];
int numberOfDependentVar = sis.getNumberOfDifferentialEquations();
double[] y = new double[numberOfDependentVar];
for(int i = 0 ; i < numberOfDepend... |
3793a83f-9275-47f0-b01c-4bebe508a768 | 2 | protected List createParentBoundables(List childBoundables, int newLevel) {
Assert.isTrue(!childBoundables.isEmpty());
ArrayList parentBoundables = new ArrayList();
parentBoundables.add(createNode(newLevel));
ArrayList sortedChildBoundables = new ArrayList(childBoundables);
Collections.sort(sortedCh... |
3fd2fc7c-0971-4e54-919a-8d6dc55ed088 | 2 | public void clearPathParents() {
if(noChildren()) {
this.pathParent = null;
} else {
for(int x = 0; x<this.children.length; x++) {
this.children[x].clearPathParents();
}
}
} |
601902ee-8b91-4ee3-9879-51da5d5f2a0b | 8 | public void keyReleased(KeyEvent arg0) {
switch(arg0.getKeyCode()){
case left:
case a:
lDown.set(lDown.get()-1);
break;
case right:
case d:
rDown.set(rDown.get()-1);
break;
case up:
case w:
uDown.set(uDown.get()-1);
break;
case down:
case s:
dDown.set(dDown.get()-1);
break;
}... |
d51ef1a6-1436-4fe6-b67f-4353292ff278 | 2 | public void setCurCapacity(int curCapacity) throws CarriageException {
if ((curCapacity <= this.maxCapacity) && (curCapacity >= 0)) {
this.curCapacity = curCapacity;
} else {
throw new CarriageException(
"Current capacity is out of range [0, " + this.maxCapacity
+ "]");
}
} |
a2102185-529d-4a96-9082-0b9a6b6212da | 7 | public void CreatePopulation(int popSize)
throws Exception{
InitPopulation(popSize);
/** Delimit the best attributes from the worst*/
int segmentation =m_numAttribs/2;
/*TEST*/
/* System.out.println ("AttributeRanking");
for (int i = 0; i <attributeRanking.size (); i++){
if(i ==segmentation)S... |
22d49fc5-be38-48c4-9087-6936273c3d2d | 0 | @SuppressWarnings("rawtypes")
public MissingRequiredServiceException(java.lang.Class serviceType)
{
super(String.format("Cannot find required service %s", serviceType.getName()));
} |
6e554153-4c50-4a04-92ab-b17c30085a39 | 7 | public void show( SJSelectionBox selBox, Component parent ) {
// we can't use regular pop-ups, b/c they don't support focus.
// create our window:
if( w != null )
w.dispose();
this.selectionBox = selBox;
//windowForComponent() seems to call up the parent in dialogs. Not what we want.
Window parentWindow ... |
6ada065a-4095-40cc-8c38-9f9e8a33d833 | 6 | public void actionPerformed(ActionEvent e) {
Debug.println("PlayerSelect.MyJPanel.actionPerformed()");
if (e.getActionCommand().equals("Select")) {
if (one.isSelected()) {
fc.setNumPlayers(1);
}
if (two.isSelected()) {
fc.setNumPlayers(2);
}
if (three.isSelected()) {
fc.setNumPl... |
c72df10f-936a-4ffc-b04d-dcfbcbc3343f | 2 | public static void setLevel(int level) {
if(level <= 0) {
Debugger.level = 0;
} else if(level >= DEBUG_FULL) {
Debugger.level = DEBUG_FULL;
} else {
Debugger.level = level;
}
System.out.println("[Debugger] Debugging level has been set to " + Debugger.level);
} |
c104024e-5ff3-4d39-867d-75e30ce77962 | 2 | @Override
public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException, IOException {
if (!systemId.toLowerCase(Locale.getDefault()).startsWith("http://")) {
final URL resource = getClass().getResource("flatpack.dtd");
if (resource != null) {
... |
f4c9bd23-de29-4629-ba5a-9e33e53083b0 | 7 | private static double dichotomyComputeBestThreshold(ArrayList<Double> leftClass, ArrayList<Double> rightClass, double lowerBound, double upperBound)
{
//System.out.println("=== Compute Optimal Threshold ===");
ArrayList<Double> leftClassBadPlaced = new ArrayList<Double>();
ArrayList<Double> rightClassBadPlaced =... |
f04ab25f-227c-4e6d-a1c4-8136b9e28a76 | 5 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._var_ == child)
{
this._var_ = null;
return;
}
if(this._aDe_ == child)
{
this._aDe_ = null;
return;
}
if(... |
5d6c7f5d-727a-4674-9b40-6258ca88fe14 | 1 | public void visitAddressStoreStmt(final AddressStoreStmt stmt) {
print("La");
if (stmt.sub() != null) {
print(new Integer(stmt.sub().returnAddress().index()));
} else {
print("???");
}
println(" := returnAddress");
} |
f67945a3-a456-49a3-ba73-9d703a910fc4 | 6 | @Override
public void increaseAmount(ResourceType resource) {
switch(resource){
case BRICK:
discardView.setResourceDiscardAmount(ResourceType.BRICK, ++brickDiscardAmount);
updateButtons(brickDiscardAmount,brickMax,resource);
break;
case ORE:
discardView.setResourceDiscardAmount(ResourceType.OR... |
3def543e-3fa0-4d0c-bb4f-5321d22d2470 | 5 | public boolean createDatabaseStatment(String stat) {
StringTokenizer str = new StringTokenizer(stat);
if (!str.hasMoreTokens())
return false;
String firstWord = str.nextToken();
if (firstWord.equalsIgnoreCase("create")) {
if (!str.hasMoreTokens())
return false;
String secondWord = str.nextToken(... |
afab4ac1-bdf1-462d-b333-57e39559e313 | 8 | @Override
public String execute(){
String actionResult = "";
try{
Map<String, Object> session = ActionContext.getContext().getSession();
User user = (User) session.get("USER");
list = new DataService().getUseSubUserList(user.getUserId(),user.getUprofile());
... |
3bc9eec2-77d2-4ccf-aa24-acd0512a265d | 8 | private static int colUItoArray(char input) {
switch (input) {
case 'a':
return 0;
case 'b':
return 1;
case 'c':
return 2;
case 'd':
return 3;
case 'e':
return 4;
case 'f':
return 5;
c... |
99e9d5cf-b88a-463d-a111-1e0f8e90af9f | 4 | final public CycList existForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException {
CycVariable var = null;
CycObject sent = null;
CycList val = new CycList();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case THEREEXISTS_CONSTANT:
jj_consume_token(THEREEXISTS_... |
04344ffe-1557-4cfb-b3d1-52dec7471946 | 3 | @Test
public void test() {
for(User user : users) {
if(!MongoHelper.delete(user, "users"))
TestHelper.failed("delete failed");
if(MongoHelper.fetch(user, "users") != null)
TestHelper.failed("user was not deleted");
System.out.println("D... |
3f2fd51b-1b1d-43ec-9ad5-a4f8ef0915d1 | 0 | @Test
public void test_getSizeX(){
assertNotNull(pawn);
assertEquals(posX, pawn.getX());
} |
32f22363-184f-4cf6-a833-d41824665252 | 6 | public static <T extends Comparable<T>> MyListNode<T> insertionSorting(MyListNode<T> head) {
if(head == null) {
return null;
}
MyListNode<T> tmpHead = new MyListNode<T>();
tmpHead.next = head;
MyListNode<T> currNode = head.next;
head.next = null;
while(currNode != null) {
MyListNode<T> next = ... |
91ea61ed-e289-4b17-b2d4-a1101a1f1e41 | 1 | public void triggerAllDoneEvents()
{
for(Event e: events){
e.triggerEvent();
}
} |
10d98ed1-2128-4e2e-8b38-11abc4cedc69 | 1 | public void dailyBonus(Player player)
{
if (color == player.getColor()) {
type.dailyBonus(player);
}
} |
bbc38d75-b9cc-4f60-b6b3-65c63de40583 | 0 | @Override
public List<LocalWebDriver> get()
{
return localWebDrivers;
} |
3bd46f91-50c1-4972-a5e6-372f8b178a06 | 2 | public PhasorMatrix subarray_as_Phasor_columnMatrix(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Phasor[] pp = this.getArray_as_Phasor();
Phasor[] retArray = new Phasor[end-start+1];
... |
0b78b370-1ed3-4141-998a-ffd28490c1b7 | 4 | public static void init()
{
for(int i = 0; i < DataInfo.numUsers; i++)
for(int j = 0; j < DataInfo.hidVariables; j++)
tPuz[i][j] = DataInfo.Puz[i][j];
for(int i = 0; i < DataInfo.numItems; i++)
for(int j = 0; j < DataInfo.hidVariables; j++) {
tPsz[i][j][0] = DataInfo.Psz[i][j][0];
tPsz[i][j][1... |
6c41b480-baa2-4447-aec2-3c4f24844e2e | 8 | public static void main(String[] args) {
Stats stats;
if (args != null && args.length > 0 && "array".equalsIgnoreCase(args[0])) {
stats = new ArrayStats(MAX_COUNT);
} else {
stats = new DirectBufferStats(MAX_COUNT);
}
final Message first = new Message(sequ... |
bb24f713-8378-4b29-b01a-2fc7618670c9 | 3 | @Override
public int[] doInPreparedStatement(PreparedStatement ps) throws SQLException {
int batchSize = argsList.size();
// 判断JDBC是否支持批量更新,如果支持直接调用批量执行方法,否则逐行执行。
if (JdbcUtils.supportsBatchUpdates(ps.getConnection())) {
for (int i = 0; i < batchSize; i++) {
setParameterValue(ps, argsList, i);
ps.addB... |
afe1ab96-d8b7-4a70-aa4a-120f52e8ca89 | 8 | public void Solve() {
List<Integer> primes = Euler.GetPrimes(_max);
long sum = 0;
int found = 0;
for (Iterator<Integer> it = primes.iterator(); it.hasNext();) {
Integer prime = it.next();
if (prime < 10) {
continue;
}
Stri... |
56c2cbf8-61e2-4332-b441-cf694a490951 | 2 | public void run() {
//System.out.println(this + " is running! at " + _ts.currentTime());
if (this.isDisposed()) {
//object is disposed, don't do anything with it!
return;
}
if (this.getCurrentRoad().getClass() == Intersection.class) {
//System.out.println(this + " is inside the intersection! " + ((In... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.