method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b7d236b7-74b1-4822-801e-ce7c84a5d666 | 8 | public void backward(float delta, Level level, int currentRoom) {
float x,y,z,minX,maxX,minY,maxY;
List<Float> obsList = new ArrayList<Float>();
minY = level.getRoomList().get(currentRoom).getPos().getY();
maxY = level.getRoomList().get(currentRoom).getPos().getY() + level.getRoomList().get(currentRoom).getDy(... |
e68a31f7-d7e9-4490-bac1-ba53d29d9ac8 | 5 | public static void validateTour(Tour tour) throws TechnicalException {
if (tour == null) {
throw new TechnicalException(MSG_ERR_NULL_ENTITY);
}
if ( ! isValidDiscount(tour.getDiscount())) {
throw new TechnicalException(DISCOUNT_ERROR_MSG);
}
if ( ! isValid... |
743db422-330f-44e4-a48d-28dc458d76ef | 3 | protected String createJSON(List<String> values) {
final OutputStream out = new ByteArrayOutputStream();
final ObjectMapper mapper = new ObjectMapper();
String output = "";
try {
mapper.writeValue(out, values);
final byte[] data = ((ByteArrayOutputStream) out).toByteArray();
output = new String(data)... |
eed30b26-be57-4b72-b97c-e6fa3e5630bd | 5 | public String[] getFilteredCourses(boolean undergrad, boolean grad) {
ArrayList<String> filteredList = new ArrayList<String>();
for(Course course : courses.values()) {
String numWithNoX = course.getCatalogNumber().replaceAll("X", "0");
int courseNumber = getStringValue(numWithNoX);
if(undergrad && courseNu... |
be10fabb-b6fb-4fa7-a1be-c6782f3bc81c | 0 | protected String getRtnCode(int codeNum) {
return this.rtnCodes.get(codeNum);
} |
84072587-2e01-4e38-8737-8f010643390f | 1 | @Override
protected void logBindInfo(Method method) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功");
}
} |
fdab412c-e1f9-4391-a375-2bc4526a4cc9 | 2 | public static boolean insertar_nuevo(Producto x){
try{
BufferedWriter escribe=Files.newBufferedWriter(path,
java.nio.charset.StandardCharsets.UTF_8, java.nio.file.StandardOpenOption.APPEND);
escribe.write(x.getCod()+";"+x.getDesc()+";"+x.getStock()+";"+x.getPrecio());
escribe.newLine()... |
675af81b-6b6b-4128-9dbc-c880a103a4ee | 5 | @Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
String pathInfo = request.getServletPat... |
e8ea08d9-2f50-4d33-908e-cfb8ee816902 | 9 | public boolean isCompleteSubtree(PGridPath prefix) {
int prefixCount = 0;
int conjCount = 0;
for (String unsolved : unsolvedPaths_.keySet()) {
PGridPath unsolvedPath = new PGridPath(unsolved);
if (unsolvedPath.hasPrefix(prefix)) {
prefixCount++;
... |
9fb31aea-eee4-4c0b-a55e-d2073e67654f | 8 | private String useRbondVariables(String s, int frame) {
if (!(model instanceof MolecularModel))
return s;
MolecularModel m = (MolecularModel) model;
int n = m.bonds.size();
if (n <= 0)
return s;
int lb = s.indexOf("%rbond[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
RadialB... |
3d0828ee-2d9f-48e9-aca7-36a276efe071 | 7 | public boolean isTrip() {
boolean retBoo = false;
if (_cards.size() >= 3) {
if (!(isPair()))
return retBoo;
else {
for (int i = 0; i < _cards.size()-2; i++) {
for (int x = (i+1); x < _cards.size()-1; x++) {
if (_cards.get(i).compareTo(_cards.get(x)) == 0) {
for (int p = (x+1); p < _card... |
a99ff4bc-a33f-4d19-a408-10beb1683546 | 8 | public LearningEvaluation evalModel(InstanceStream trainStream, InstanceStream testStream, AbstractClassifier model) {
model = new SelfOzaBoostID();
InstanceStream stream = (InstanceStream)trainStream.copy();
ClassificationPerformanceEvaluator evaluator = new BasicClassificationPerformanceEvalu... |
70501615-0729-4604-aa3d-bb6289bbd5ce | 5 | private boolean askNodesorFinish() throws IOException
{
/* If >= CONCURRENCY nodes are in transit, don't do anything */
if (this.config.maxConcurrentMessagesTransiting() <= this.messagesTransiting.size())
{
return false;
}
/* Get unqueried nodes among the K close... |
a855f75a-19cc-449e-a845-a174eb99fa39 | 0 | public void setGoTo(String []goTo) {
this.goTo=goTo[0];
} |
38280a7b-d911-4808-b9a0-b1957f31aa35 | 3 | public Actor remove(AdvancedLocation loc) {
switch (loc.getLayer()) {
case ActorLevel:
return super.remove(loc);
case FloorLevel:
return this.mapGrid.remove(loc);
case ObjectLevel:
return this.objectGrid.remove(loc);
... |
3856e818-ab1a-45bd-bede-ab917faff543 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
f42bf744-b2bb-476d-a496-493b29dcb328 | 5 | static boolean agregarColeccion( Coleccion tipo ){
try{
if( tipo == Coleccion.CHAR)
cols[ cont ] = new ColeccionChar();
else if( tipo == Coleccion.DOUBLE )
cols[ cont ] = new ColeccionDouble();
else if( tipo == Coleccion.INTEGER )
... |
748d2581-11c9-4698-9345-873ae14def1d | 0 | public SaltAlgorithmIdentifierType getOtherSource() {
return otherSource;
} |
8305adb4-6b83-4c43-ab39-53b7e41e7e1d | 6 | @Override
public void consequent(CounterActionFactory CAF) {
// retrieve master name
String mName = (String) Serializer.deserialize(null, "mastername.dat");
String question = "What can I help you with?";
if (mName != null) {
question = "What can I help you with "+ mName +"?";
}
// show menu
C... |
6039cde2-8059-42d0-bdc2-f59a7649198c | 9 | public static void main(String[] args){
int bufferSize=20;
Scheduler sched;
for(int iloscWatkow=10; iloscWatkow<51; iloscWatkow+=10)
{
watki++;
for(int czasMetody=0; czasMetody<101; czasMetody+=20)
{
czasy++;
System.out.println("WATKI "+ iloscWatkow + " CZAS " + czasMetody);
int... |
33b238ff-58c4-4a84-a38d-34432a5a7737 | 0 | public double getSalary()
{
return salary;
} |
7d675ae9-d920-405b-b612-cfa66ce6c488 | 2 | public User findUser(String username, String password) {
String query = "SELECT * FROM user WHERE username = '%s' AND password = '%s'";
DBA dba = Helper.getDBA();
try {
ResultSet rs = dba.executeQuery(String.format(query, username, password));
while (rs.next()) {
... |
0be31168-c8e6-4286-b6a0-c22e532d63f2 | 1 | protected void fireDocumentRemovedEvent(Document doc) {
removedEvent.setDocument(doc);
for (int i = 0, limit = documentRepositoryListeners.size(); i < limit; i++) {
((DocumentRepositoryListener) documentRepositoryListeners.get(i)).documentRemoved(removedEvent);
}
// Cleanup
removedEvent.setDocument(null... |
3c7cecd0-964c-4d4b-91dd-0e0d7d0b4d56 | 3 | public ItemSet GetUniqueItems() {
ItemSet uniqueItems = new ItemSet();/*uniquely constructed itemSet*/
for (int j = 0; j < transactionSet.size(); j++) {/*loop through the first transactionSet object*/
for (int i = 0; i < transactionSet.get(j).getTransaction().getItemSet().size(); i++) {/*doubly loop through each... |
431cb2c6-2f5a-45e7-a825-75c780958c20 | 0 | @Override
public Watcher addWatcher(String folderPath, int mask, boolean watchSubtree) throws IOException {
int watcherId = JNotify.addWatch(folderPath, mask, watchSubtree, jNotifyListener);
WatchKey watchKey = new JNotifyWatchKey(watcherId, folderPath);
Watcher watcher = new Watcher(watchKey, folderPath, mask, ... |
e892af2a-9922-437a-afb6-b6a4d9958e6c | 3 | private static byte[] deCrypt(byte[] cryptMsg, int Tabid){
PDU encryptedPDU = new PDU(cryptMsg, cryptMsg.length);
byte[] encryptedMsg = null;
try {
int algorithm = encryptedPDU.getByte(0);
int checksum = encryptedPDU.getByte(1);
int cryptLength = encryptedPDU.... |
31c35866-2da0-42e6-9417-7b9b5829cc4b | 6 | private Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
55c7345a-22ff-4d4f-8e4f-a85bb83579e8 | 8 | public int convertNumber(List<String> input)
{
if(checkIfZero(input.get(0)) || input.size() < 1)
{
return 0;
}
int number = 0;
boolean negative = false;
while(!input.isEmpty())
{
if(checkIfNegative(input.get(0)))
{
negative = true;
input.remove("negative");
input.remove("minus");
... |
b3db87d4-b42b-485d-9a68-8146a0dc4130 | 8 | public Cell attackClosestUnit_(Queue<Cell> queue,
ArrayList<Cell> expandedNodes) {
Queue<Cell> newQueue = new LinkedList<Cell>();
Cell returnCell = null;
// if there are still nodes
while (!queue.isEmpty()) {
Cell currentNode = queue.poll();
Queue<Cel... |
995467d3-f87d-47a6-a09c-42fc26d04d10 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PlayerChoice other = (PlayerChoice) obj;
if (getCode() == null) {
if (other.getCode() != null)
return false;
} else if (!getCode().eq... |
dc399430-765c-4516-a93d-66830e2ad720 | 1 | public void addValidationMessage(BeamMeUpMQError errorMessage) {
if (validationErrorMessages == null) {
validationErrorMessages = new ArrayList<BeamMeUpMQError>();
}
validationErrorMessages.add(errorMessage);
} |
737be629-f2f5-43a8-a099-d9d5c6ab8fa8 | 2 | public Entity init(){
setVelocity(new Vector2f(-0.3f,0.2f));
try {
AddComponent( new ImageRenderComponent("BirdRender", new Image("assets/bird.png")) );
} catch (SlickException e) {
// TODO Auto-generated catch block
e.printStackTrace();
... |
d6a9c228-7fed-422e-ad3e-d2c48821be39 | 2 | public final boolean onCommand(CommandSender sender, Command cmd,
String alias, String[] args) {
try {
Method method = this.getClass().getDeclaredMethod(cmd.getName(),
CommandSender.class, String[].class);
return (Boolean) method.invoke(this, sender, args);
} catch (InvocationTargetException e) {
p... |
216c925b-c534-48bd-89d5-69702a7b968d | 7 | public static String insertarRegistros( String nombreTabla, String[] camposTabla, String[] valoresTabla ) throws Exception
{
String query = "INSERT INTO " + nombreTabla;
if( camposTabla != null)
{
query += " (";
for( int i = 0; i < camposTabla.length; ++i ){
query += camposTabla[i];
if( i < campos... |
5d425e1c-5e21-4516-a5a8-619de367d5af | 0 | private void jComboBoxVisiteurActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxVisiteurActionPerformed
((CtrlVisiteur)controleur).visiteurSelectionner();
}//GEN-LAST:event_jComboBoxVisiteurActionPerformed |
c9f96f4a-035b-4607-a83c-9f8987f91bd4 | 1 | private void init() {
for (int i=0; i< NUMBER_OF_EQUATION_PARAMETERS; i++) {
textFields[i] = new JTextField(TEXT_FIELD_MIN_WIDTH);
}
numberOfPointsTextField = new JTextField(TEXT_FIELD_MIN_WIDTH);
timeStepTextField = new JTextField(TEXT_FIELD_MIN_WIDTH);
timePeriodT... |
e8987dcd-7cf0-4335-b441-669b97e86526 | 8 | public static String propositiontoString(Proposition p){
switch(p){
case IS_FRONT_CLEAR: return "Front is Clear";
case IS_LEFT_CLEAR: return "Left is Clear";
case IS_RIGHT_CLEAR: return "Right is Clear";
case IS_FACING_NORTH: return "Facing North";
case IS_FACING_SOUTH: return "Facing South";
... |
91c04c6f-4063-4b4f-957a-fe78fa2f3c1a | 9 | final public int writeVarLong (long value, boolean optimizePositive) throws KryoException {
if (!optimizePositive) value = (value << 1) ^ (value >> 63);
int varInt = 0;
varInt = (int)(value & 0x7F);
value >>>= 7;
if (value == 0) {
write(varInt);
return 1;
}
varInt |= 0x80;
varInt |= ((value & ... |
0f81bd4c-005d-4115-8963-5cdff6ad41bf | 2 | private String readAxiom(Document document) {
NodeList list = document.getDocumentElement().getElementsByTagName(
AXIOM_NAME);
if (list.getLength() < 1)
throw new ParseException("No axiom specified in the document!");
String axiom = containedText(list.item(list.getLength() - 1));
if (axiom == null)
ax... |
632120cd-6096-4723-a8d6-7589660192b6 | 3 | private List<Entry<Integer, Object[]>> createQueryParametersList(E value) {
ClassInspect inspector = getClassInspector();
List<Entry<Integer,Object[]>> queryParameterValues = new LinkedList<Entry<Integer,Object[]>>();
List<Field> annotatedFields = inspector.findAllAnnotatedFields(Column.class);
int columnCount... |
1f596f58-57b5-4fac-b76d-cde9a9528f88 | 2 | private static String readFile(String filePath) {
Logger.log("Opening file " + filePath);
File file = new File(filePath);
assert file.exists();
assert file.isFile();
assert file.canRead();
Scanner s = null;
try {
s = new Scanner(file);
} catch (FileNotFoundException e) {
Logger.log("Error reading ... |
a17a7f43-1b54-462b-b27d-7320050922a5 | 9 | public boolean run() {
PrintStream original = System.out;
PrintStream noPrint = new PrintStream(new OutputStream() {
public void write(int b) {}
});
try {
Method m[] = this.getClass().getDeclaredMethods(); // Get all methods
for( Method i : m ) {
if( i.getName().startsWith("test... |
02050374-cf69-46d1-aa41-5681cb5f2c85 | 3 | private boolean isReady(Document doc)
throws Exception {
if (props.getProperty("checkPagePDFExists", "false").equalsIgnoreCase("true")) {
// check if PDF for the page exists
String strPagePDF = "";
NodeList nl = (NodeList) xp.evaluate("//NewsItem[NewsMana... |
d4a499ac-1484-41df-9f59-86a224d99305 | 8 | public static ArrayList<Double> firstXPrimeNumbers(double number) throws MathException{
ArrayList<Double> primes = new ArrayList<Double>();
boolean prime = true;
double sqRoot;
//Error detected
if(number < 1){
throw new MathException("Invalid input, minamum is 1");
}
primes.add(2.0);
//Logi... |
ac51f33e-11b0-484b-8f2d-740bc2107c39 | 9 | public Equipa(String codigo,String nome,String Escalao, String cod_Escola) {
this.codEquipa = codigo;
this.nome = nome;
this.codEscola = cod_Escola;
this.DAOJogador = new DAOJogador();
switch (Escalao) {
case "Escalao.EscolaA":
escalao = new EscolaA();... |
4dc3889d-42d2-4eb4-8bc7-2c4e00fb7744 | 9 | public Instances transform(Instances train) throws Exception{
Attribute classAttribute = (Attribute) train.classAttribute().copy();
Attribute bagLabel = (Attribute) train.attribute(0);
double labelValue;
Instances newData = train.attribute(1).relation().stringFreeStructure();
//insert a bag label... |
71d15b5f-b9c9-4f7b-96cc-8a8dbfaaaeae | 5 | public static void spielendeabrechnung() throws IOException {
if(punktespieler1 > punktespieler2 + 20) {
System.out.println("("+ausgabenummer+") "+spielername1+" gewinnt die Partie hochverdient!"); ausgabenummer += 1;
System.out.println("("+ausgabenummer+") "+"Er gewinnt mit "+punktespieler1+" zu "+punktespiele... |
258ac9d0-3ca9-4e78-a469-c6c9bfaeabb3 | 3 | public Integer getMatchName(String matchvalue) {
if (this.getMatchSring().equals(matchvalue)) {
return string_name;
}
if (this.getMatchNum().equals(matchvalue)) {
return num_name;
}
if (this.getMatchOperacion().equals(matchvalue)) {
return oper... |
89ce4ca3-3aae-492f-9de0-501f38cbfe87 | 0 | @Test
public void testCalculateTotal() throws Exception {
BigDecimal bdRes;
this.terminal.scan("ABCDABA");
BigDecimal bd1 = BigDecimal.valueOf(13.25);
bd1 = bd1.setScale(2,BigDecimal.ROUND_HALF_DOWN);
bdRes = terminal.calculateTotal();
assertTrue(bd1.equals(bdRes));
this.terminal.scan("CCCCCCC");
... |
9634d959-963f-4dcd-a64b-8dadb3eaa298 | 1 | public void setTipoPasajero(String tipoPasajero) {
if (tipoPasajero.length() <= 3) {
this.tipoPasajero = tipoPasajero.trim();
}else{
this.tipoPasajero = "ADT";
}
} |
d9950a70-453f-4f9a-9ab1-f11f9ace49b4 | 7 | public void add_all_features(String[] features_string){
for(int i=0;i<features_string.length;i++){
String[] feature_parsed= features_string[i].replace(":", " ").trim().split("\\s+");
int f_id= Integer.parseInt(feature_parsed[0]);
if(!index){
feat_present.add(f_id); // uncomment if not required
}
... |
c0d7821a-8090-49b1-ba91-48373db62ca1 | 0 | public int getMaxRound()
{
return maxRound;
} |
526a5130-a5de-4c66-9ee9-ebb43f96a917 | 8 | @Override
public void run() {
boolean error = false;
_shouldStop = false;
System.err.println("Sugar interpreter started");
if (null != _listener) {
_listener.interpreterStarted(this);
}
try {
Environment e = _rootEnvironment;
e.pushReader("bootstrap");
e.pushOp("read");
e.evaluateSt... |
0eec7c13-ae77-412c-9c81-64f1c0dbc09e | 4 | public static Attribute getSetting(PrintService service, PrintRequestAttributeSet set, Class<? extends Attribute> type, boolean tryDefaultIfNull) {
Attribute attribute = set.get(type);
if (tryDefaultIfNull && attribute == null && service != null) {
attribute = (Attribute) service.getDefaultAttributeValue(type);
... |
3aeeedcd-8048-4039-b066-75d858366020 | 8 | private final boolean tryReadPacket(final SelectionKey key, final T client, final ByteBuffer buf, final MMOConnection<T> con)
{
switch (buf.remaining())
{
case 0:
// buffer is full
// nothing to read
return false;
case 1:
// we don`t have enough data for header so we need to read
key.inte... |
802b8676-64c3-4c0b-85a0-5788d4812b71 | 3 | private void copyPALtoRGBA(ByteBuffer buffer, byte[] curLine) {
if(paletteA != null) {
for(int i=1,n=curLine.length ; i<n ; i+=1) {
int idx = curLine[i] & 255;
byte r = palette[idx*3 + 0];
byte g = palette[idx*3 + 1];
byte b = palette[i... |
12d1d3b3-e5e2-4dce-a5f5-0ed11a978421 | 3 | @Override
public void draw(Graphics2D g2d) {
for (int i = 0; i < fireBalls.size(); i++)
fireBalls.get(i).render(g2d);
if (flinching) {
long elapsed = (System.nanoTime() - flinchTimer) / 1000000;
if (elapsed / 100 % 2 == 0) return;
}
} |
473e962d-c627-477c-a7f9-6eb6b8285709 | 0 | static void tune(Instrument i) {
// ...
i.play(Note.MIDDLE_C);
} |
7ec479fc-4c2b-4121-9d64-0f402e721c01 | 3 | @Override
public AbstractComponent parse(String string) throws BookParseException {
if (string == null) {
throw new BookParseException("String is null");
}
try {
TextComponent component = (TextComponent) factory
.newComponent(EComponentType.LISTING);
for (String s : string.split(LINE_REGEX)) {
... |
2c849547-211d-40a9-960a-7a80465c0ea6 | 3 | public void insertSupplierAmount(supplier tempSupplier) throws SQLException{
try {
databaseConnector = myConnector.getConnection();
SQLQuery = "INSERT INTO familydoctor.supplier "+"VALUES(?,?,?,?)";
PreparedStatement preparedStatem... |
0a8492ab-929e-458e-9be3-46e24952aa15 | 2 | public static boolean isNullOrEmpty(String input) {
return (input == null ? true : (input.length() <= 0 ? true : false));
} |
856c78c9-030a-4b2a-bec6-747abe33e90b | 8 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
JTree tree = MainFrame.dataTree;
DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) tree
.getLastSelectedPathComponent();
int nodeLevel = selectNode.getLevel();
if (nodeLevel == 1) {
// 删除数据库
if (e.get... |
624af31d-a286-44b9-971a-394b1506bd6d | 0 | public static int hellingerDist(int color1, int color2) {
double dRed = Math.pow( Math.sqrt((color1 & RED_MASK) >> 16) - Math.sqrt((color2 & RED_MASK) >> 16),2);
double dGreen = Math.pow( Math.sqrt((color1 & GREEN_MASK) >> 8) - Math.sqrt((color2 & GREEN_MASK) >> 8),2);
double dBlue = Math.pow( ... |
04182226-2bbf-455d-9136-ff4f3a353a1f | 2 | public void visitIfCmpStmt(final IfCmpStmt stmt) {
if (stmt.right() == previous) {
check(stmt.left());
} else if (stmt.left() == previous) {
previous = stmt;
stmt.parent().visit(this);
}
} |
72962c88-16c4-4a4b-bf67-69baa36a614e | 8 | @Override
void insert() {
int ccid = -1; //1
int cphone = -1; //5
PreparedStatement ps;
BufferedReader in = new BufferedReader((new InputStreamReader(System.in)));
try {
Statement stmt = con.createStatement();
ResultSet rs;
System.out.println("Enter the C... |
13fca788-5e72-46c9-a09a-3ec8890e7691 | 0 | public String getSex() {
return sex;
} |
ff381ce0-244d-45f4-85d8-8a3ea39a6b0f | 9 | private void collectiveInstinctiveMovement() {
double[] m = new double[dimensions];
double totalFitness = 0;
// calculating m, the weighted average of individual movements
for (int i = 0; i < school.size(); i++) {
Fish _fish = school.get(i);
for (int j = 0; j < dimensions; j++) {
m[j] += _fish... |
797199ee-ea32-49f5-ae41-232046c3867a | 6 | public void test() throws IOException {
FieldCache cache = FieldCache.DEFAULT;
double [] doubles = cache.getDoubles(reader, "theDouble");
assertSame("Second request to cache return same array", doubles, cache.getDoubles(reader, "theDouble"));
assertSame("Second request with explicit parser return same a... |
1e195f3b-550f-426e-a1a0-94da0a37e7da | 9 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
{
return false;
}
byte byte0 = 11;
if (!isLargeRoom)
{
... |
e4bf7011-5904-4f47-a4da-ce029a3e123a | 5 | public void updateAsScheduled(int numUpdates) {
super.updateAsScheduled(numUpdates) ;
//
// TODO: Restore once building/salvage of vehicles is complete-
///if (! structure.intact()) return ;
base().intelMap.liftFogAround(this, 3.0f) ;
final FormerPlant plant = (FormerPlant) hangar() ... |
72024d69-c1d8-4a19-8353-c129b5506daf | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TextReader other = (TextReader) obj;
if (content == null) {
if (other.content != null)
return false;
} else if (!content.equals(other.co... |
9d8353ad-0407-4718-bae8-40306072232c | 6 | public boolean needsCrypt() {
return ((this.sslMode == FTPConnection.AUTH_SSL_FTP_CONNECTION || this.sslMode == FTPConnection.AUTH_TLS_FTP_CONNECTION || this.sslMode == FTPConnection.IMPLICIT_SSL_WITH_CRYPTED_DATA_FTP_CONNECTION || this.sslMode == FTPConnection.IMPLICIT_TLS_WITH_CRYPTED_DATA_FTP_CONNECTION) && ... |
77b92f6d-3145-4919-b28f-0fd71ff0d235 | 1 | public static void main(String[] args) {
String key = "ARVINBEHSHAD";
LinkedList<Character> word = new LinkedList<Character>();
for (int i = 0; i < key.length(); i++) {
word.append(key.charAt(i));
}
word.reverseList();
System.out.println("Reverse: " + word.toString());
word.reverseList();
System.o... |
fe1b3d21-828b-458f-a8e6-4d87828b52e6 | 2 | private Object convertRvalue(Object rvalue)
throws CannotCompileException
{
if (rvalue == null)
return null; // the return type is void.
String classname = rvalue.getClass().getName();
if (stubGen.isProxyClass(classname))
return new RemoteRef(exportObj... |
503fedcc-70f3-427e-a9e4-b7353395cb87 | 3 | public synchronized void receive(Message m) {
String type = m.getType();
if (type.equals("heartbeat")) {
detector.receive(m);
} else if(type.equals("VAL")){
detector.addConsensusMessage(m);
} else if(type.equals("OUTCOME")){
detector.addOutcomeMessage(m);
}
} |
768ea482-c091-42f6-8cb9-abe44ca0f0d6 | 1 | public static void main(String[] args) {
int num1=0,num2=0;
// TODO Auto-generated method stub
try {
Scanner sc=new Scanner(System.in);
num1=sc.nextInt();
num2=sc.nextInt();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Sum1toN s=new Sum1toN();
System.o... |
d0b96f56-da13-4b2c-aacf-7a8db45c9c7a | 1 | public List<Double> getRPRowList(int index) {
List<Double> result= new ArrayList<Double>();
double[] values= this.getRPRowArray(index);
for (int i= 0; i< values.length; ++i) {
result.add(Double.valueOf(values[i]));
}
return result;
} |
d1cd87a8-4db7-4045-b69e-ab19d1941e8a | 0 | public void setDisplayImage (Image dispImage) {
displayImage = dispImage;
} |
691643ce-345e-4757-9711-c69ba21cc7c5 | 9 | public static void main(String[] args) throws IOException,
ClassNotFoundException
{
Driver d = new Driver();
Main.init();
TrigramProbGen t = new TrigramProbGen();
LevenshteinDistance LD = new LevenshteinDistance();
// What we essentially need to do is to take a particular phrase/
// sentence, and first... |
692a2cf7-bd57-485e-bf1d-6c1be63218c8 | 5 | public AnnotationVisitor visitParameterAnnotation(
final int parameter,
final String desc,
final boolean visible)
{
AnnotationNode an = new AnnotationNode(desc);
if (visible) {
if (visibleParameterAnnotations == null) {
int params = Type.getArgumen... |
0af76fb7-d2ff-4d4b-84d7-9d11451c4a6e | 1 | static public Object deserializeArrayResource(String name, Class elemType, int length)
throws IOException
{
InputStream str = getResourceAsStream(name);
if (str==null)
throw new IOException("unable to load resource '"+name+"'");
Object obj = deserializeArray(str, elemType, length);
return obj;
} |
7a3748d7-f3bd-40c7-8f0f-f4d11755315f | 4 | private AFParser recursiveInvertedAFNEGenerate(RegularExpresionNode node) {
AFParser result = null;
if(node instanceof ConcatNode){
RegularExpresionNode left = ((ConcatNode)node).leftOperandNode;
RegularExpresionNode right = ((ConcatNode)node).rightOperandNode;
result... |
aa5b49e9-cedc-46ed-8a53-a3571ba177e7 | 0 | @Basic
@Column(name = "name")
public String getName() {
return name;
} |
d2ffcb41-64ac-47ed-bf8e-e7de64367bb2 | 1 | @Override
public boolean isOpaque() {
return super.isOpaque() && !mDrawingDragImage;
} |
dba80112-d92d-47e7-948d-7a4ab8639691 | 4 | @EventHandler
public void RightClick(PlayerInteractEvent event) {
final Player p = event.getPlayer();
boolean mode = getConfig().getBoolean(p.getName().toLowerCase() + ".mode");
if(event.getAction().toString() == "RIGHT_CLICK_BLOCK") {
if(p.getItemInHand().getType().equals(Material.EMERALD)) {
p.openInven... |
b942e394-eea5-41d6-a60b-4a92acffa67d | 4 | @Override
public String buscarDocumentoPorConcepto(String concepto) {
ArrayList<Venta> geResult= new ArrayList<Venta>();
ArrayList<Venta> dbVentas = tablaVentas();
String result="";
try{
for (int i = 0; i < dbVentas.size() ; i++){
if(dbVentas.get(i).getConcepto().... |
ca322f84-5326-4259-bc9d-3b75ec33fb44 | 5 | public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
System.out.println("This is my new Filter");
if (debug) {
log("testFilter:doFilter()");
}
doBefo... |
c5e4a406-b62f-40ed-9bf5-fffcc8da3674 | 5 | @Override
protected ArrayList<PossibleTile> getLazyTiles(Board b) {
ArrayList<PossibleTile> lazyTiles = new ArrayList<PossibleTile>();
PossibleTile step1;
if (isWhite) {
Pawn clone = this.clone();
clone.setMoved();
step1 = new PossibleTile(clone.getX(), clone.getY() - 1, clone);
} else {
Pawn clone... |
5ad14fea-a242-4d82-b2fe-12c5dde27c28 | 9 | private void onAdd() {
try{
Double averageConsumption = Double.parseDouble(tfAverageConsumption.getText().replace(",", "."));
String fuelType = (String) cbFuelType.getSelectedItem();
int cargo = (int) Double.parseDouble(tfCargo.getText().replace(",", "."));
Linked... |
8d11d5c7-32d7-4672-b58d-fdfd026f2adb | 2 | private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
//Создаем новую кредитную программу по заполненным полям
CreditProgram crProg = new CreditProgram();
try {
crProg.setName(textFieldName.getText());
crProg.s... |
7a59b116-5cec-483f-b91d-9547609966f5 | 2 | public static void cleanMemory(){
byte[] trash = new byte[10240000];
File f = new File(Params.testFolder + java.io.File.separator + "trash.txt");
FileOutputStream fout = null;
try{
fout = new FileOutputStream(f);
for(int i = 0 ; i < 1000 ; i++) fout.write(trash);
fout.close();
... |
a17a326f-5c43-4b41-b3b3-7f504e306189 | 6 | @EventHandler
public void onPlayerDamagedByPlayer(EntityDamageByEntityEvent event) {
if (event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
switch (HeroesHandler.inGamePlayers.get(event.getDamager())) {
case EARTH_SHAKER: {
break;
}
case ICE: {
((Player) event.getEnti... |
b4d81216-38bf-410a-8f78-44d4d07cc55a | 1 | public void checkConsistent() {
if (!(outer instanceof SwitchBlock))
throw new jode.AssertError("Inconsistency");
super.checkConsistent();
} |
e027e94e-34a4-4cc3-b5a7-f410b2342fb4 | 0 | @Override
public String toString(){
return "Units " + name;
} |
74c17bab-8335-4846-8751-c8f3a3a05c08 | 9 | public static double evaluateNDCG(int k, HashMap<String, HashMap<Integer,Double>> relevance_judgments_2,
String path){
double NDCG = 0.0, IDCG=0.0;
List<Double> relevance = new ArrayList<Double>();
try {
BufferedReader reader = new BufferedReade... |
f00d942e-4226-44c8-ba1c-a3957de1ff32 | 8 | public Player getDamager(Entity damager, boolean allowPets)
{
// Check if the damager is a player
if (damager instanceof Player)
{
return (Player) damager;
}
// Check if the damager is a projectile from a player
else if (damager instanceof Projectile)
{
Projectile projectile = (Projectile) damager;... |
9968bc0b-a1f5-499f-8099-61101db4ffa8 | 9 | public void readItems() {
while (custDataIn.hasNextLine()) {
String temp = custDataIn.nextLine();
if (checkDate(temp))
date = temp;
else {
throw new IllegalArgumentException();
}
System.out.println("DATE: " + date);
while (custDataIn.hasNextLine()) {
String line = custDataIn.next();
... |
2c0d27ce-57e2-4561-b32b-953a7a556320 | 4 | private float min(ArrayList<Float> data) {
float min = Float.POSITIVE_INFINITY;
for (float f : data) {
if (f != f)
continue;
if (f < min)
min = f;
}
if (min == Float.POSITIVE_INFINITY)
min = -1e-7f;
return min;
} |
e9006eb5-e71b-471e-b2db-c33dc45b105b | 8 | public static void main(String[] args) {
EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 10, "(0|101|11(01)*(1|00)1|(100|11(01)*(1|00)0)(1|0(01)*(1|00)0)*0(01)*(1|00)1)*");
int solutionFoundCounter = 0;
int noSolutionF... |
204d6630-04d2-4c6b-9f1f-7c5345564639 | 9 | private void getServersList(PrintWriter out) {
out.println("matchlist" + Utils.SEPARATOR + "beginning");
out.println(liste.size());
Iterator<Match> it = liste.iterator();
while ( it.hasNext() ){
Match m = ((Match) it.next());
String display = ( m.getType() == Utils.Types.ONEVSONE ? "1vs1" : ( m.getType() ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.