method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a32f18b4-426b-44df-99f7-5c7b33c6d284 | 8 | public static ArrayList<Integer> KMP(char cadena[], char patron[]) {
int[] fallas = new int[patron.length + 1];
ArrayList<Integer> coincidencias = new ArrayList<Integer>();
int pos;
Arrays.fill(fallas, -1);
// funcion de fallas
for (int i = 1; i <= patron.length; i++) {
pos = fallas[i - 1];
while (... |
6c84c4a9-5e84-4975-ba96-e906be248a99 | 7 | private boolean isEmptyLine(int index) {
int blackCounter = 0;
for (int i = index; i < index + letHeight; i += H_STEP) {
if (i >= imh)
break;
for (int j = 0; j < this.imw; j += W_STEP) {
if (j >= imw)
break;
try
... |
9ea99a96-4133-41bc-b1f9-604ba81304e6 | 9 | public VectorInfo readVectorInfo() throws IOException {
String[] component = readTrimmedLine().split(" +");
if (component.length != 4)
throw new IOException(
"Current line unparsable. It must consist of 4 tokens");
// Read header
if (!component[0].equalsI... |
2640c51b-57fe-4e2a-8b36-33e30d51aa7d | 4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(amount);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((date == null) ? 0 : date.hashCode());
result = prime * result + (isFrom ? 1231 : 1237);
result =... |
b626d385-08ec-4a3f-a6f0-7f5adee49023 | 2 | public void editMembreConsole(){
System.out.println("Édition du profil (appuyer sur Entrée pour ne pas modifier le champ, sauf pour les préférences)");
System.out.println("Votre téléphone actuel est : "+telephone);
Scanner sc = new Scanner(System.in);
System.out.print("Nouveau téléphone ? ");
String tmp = sc.... |
b553c590-0f01-4685-97da-75074c7260b2 | 7 | private Map<String,List<ProgramElementDoc>> pkgDivide(Map<String,? extends List<? extends ProgramElementDoc>> classMap) {
Map<String,List<ProgramElementDoc>> map = new HashMap<String,List<ProgramElementDoc>>();
List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
if (l... |
8f08f858-fc3e-4f7a-ba46-875bc8a1f384 | 6 | public void initialisation(){
JFrame f = new JFrame("editeur");
f.setSize(1000,1000);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
Container c = f.getContentPane();
c.setLayout(new GridLayout(13,15));
tab = new JButton[13][15];
for (int ligne = 0 ; ligne<tab.length;ligne++){
... |
0be45a73-31ad-4a0a-a483-ff6cf222cb50 | 8 | public static int Menu() {
System.out.println();
System.out.println("--- Menu de navigation ---");
System.out.println(" 1 - Consultation");
System.out.println(" 2 - Ajout");
System.out.println(" 3 - Modification");
System.out.println(" 4 - Suppression");
... |
4d4e9444-ad3e-441d-b631-3cc3a6ea0644 | 7 | public static void main( String[] args ) throws Exception
{
String describePath = null;
String configPath = null;
String javaOut = null;
int index = 0;
while ( index < args.length )
{
if ( args[index].startsWith( DESCRIBE_PATH_FLAG ) )
{
describePath = args[index].substring( DESCRIBE_PATH_FLAG.l... |
92404b39-b34b-4361-bdba-addb3aa98d48 | 3 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/mensaje.jsp");
String result;
UsuarioBean oUsuario1 = new UsuarioBean();
Usua... |
e69f72ef-5421-4380-885e-57a5bc892f6e | 0 | public void setIdleTimeout(long idleTimeout) {
this.idleTimeout = idleTimeout;
} |
c6b2bfd8-3d09-4dbd-b110-8afa93bb6ff3 | 1 | public void print()
{
while (q.size() != 0)
{
System.out.println(getNumber());
}
} |
7afb78f5-f281-47e6-a07d-02b8caaba6b5 | 9 | public void decay() {
List<Square> sq = new ArrayList<Square>();
for (int i = 0; i < gameSize; i++) {
for (int j = 0; j < gameSize; j++) {
int c = 0;
Square s = e[i][j];
if (!available(i + 1, j))
c++;
if (!available(i - 1, j))
c++;
if (!available(i, j + 1))
c++;
if (!avail... |
b06051c5-541a-4d0e-b8fa-d4029c638f11 | 6 | public ListNode mergeKLists(List<ListNode> lists) {
Queue<ListNode> queue = new PriorityQueue<ListNode>(10, new Comparator<ListNode>() {
@Override
public int compare(ListNode o1, ListNode o2) {
if(o1.val < o2.val) return -1;
else if(o1.val > o2.val) return... |
28523ab9-006b-4e61-ad64-ac5d2fdb22da | 9 | public DataSourceImpl(List<String> data) {
final Pattern p = Pattern.compile("\\{[-+#!*/]?");
for (String s : data) {
final StringTokenizer st = new StringTokenizer(s, "|}", true);
while (st.hasMoreTokens()) {
final String token = st.nextToken().trim();
if (token.equals("|")) {
continue;
}
... |
29752fc7-6378-4c40-8d48-163db9ce846b | 0 | @Override
public void loadConsole() throws DataLoadFailedException {
ConfigurationSection sec = getData("server", "console");
YamlPermissionBase permBase = new YamlPermissionConsole(sec);
load(PermissionType.CONSOLE, permBase);
} |
3476ae91-3845-4f3e-931d-8eba98d23f1b | 3 | public String toString() throws JSONException {
if (this.string == null) {
int c;
int length = 0;
char chars[] = new char[this.length];
for (int at = 0; at < this.length; at += characterSize(c)) {
c = this.characterAt(at);
if (c < 0... |
3145f885-19b0-42f0-a34c-82b8205e4a79 | 2 | public static CtMethod getter(String methodName, CtField field)
throws CannotCompileException
{
FieldInfo finfo = field.getFieldInfo2();
String fieldType = finfo.getDescriptor();
String desc = "()" + fieldType;
ConstPool cp = finfo.getConstPool();
MethodInfo minfo = n... |
5d6ee5a1-5f07-432b-8b39-fcedbc3d3ff8 | 6 | @Override
public void update(long l) {
_playField.update(l);
double speedX = 0;
if (keyDown(KeyEvent.VK_LEFT)) {
speedX = -0.5;
} else if (keyDown(KeyEvent.VK_RIGHT)) {
speedX = 0.5;
}
if (_gameModel.gameField().racket() != null) {
... |
43196543-60e0-4e34-9195-76e6a96ca7ae | 4 | public Image[] getCells(ImageRetriever paramImageRetriever, int paramInt1, int paramInt2)
{
Integer localInteger = new Integer(paramInt1 << 3 | paramInt2);
if (animationList == null)
animationList = new Hashtable();
Object localObject = animationList.get(localInteger);
Image[] arrayOfImage;
... |
ee9e4f8a-1347-483a-bbc6-34897b710bcb | 7 | public void deleteSelected() {
ConstructEditor deleteMeEditor = mConstructSelector.getSelected();
if(deleteMeEditor.construct.isSoleDependantConstruct()) {
Construct parentConstruct = mConstructSelector.getSelected().construct.parent;
deleteMeEditor = mDocument.editorsFromConstruct(parentConstruct);
}
... |
e146a33d-1cbc-4246-b72b-2bee58c4d1ce | 8 | public void keyReleased (KeyEvent ke) {
switch(ke.getKeyCode()) {
case KeyEvent.VK_W:
W_KEY = false;
break;
case KeyEvent.VK_UP:
UP_KEY = false;
break;
case KeyEvent.VK_A:
A_KEY = false;
... |
7c0dbbd1-fd2c-4d58-ad56-0590b0f28e92 | 4 | private String scanBlockScalarIgnoredLine () {
while (peek() == ' ')
forward();
if (peek() == '#') while (NULL_OR_LINEBR.indexOf(peek()) == -1)
forward();
if (NULL_OR_LINEBR.indexOf(peek()) == -1)
throw new TokenizerException("While scanning a block scalar, expected a comment or line break but found: " +... |
efa27b8b-9fa0-4018-b580-ed03b68b8442 | 2 | public SocketDescriptor() {
defaultSelectorProvider();
try {
channel = SocketChannel.open();
channel.configureBlocking(false);
writeSelector = Selector.open();
readSelector = Selector.open();
} catch(IOException e) {
throw new SystemException(e.toString());
}
try {
... |
4620e91e-4a98-459b-8d41-22167cf1b34e | 7 | private void basketClick() {
try {
jButton33.setEnabled(true);
jButton31.setEnabled(true);
jTextField1.setText("1");
Basket.resetSubCurrency();
String serverID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelect... |
3c0acd25-0e0b-44c5-9ddf-b9d8357707da | 3 | public List<Blab> getFeed(String email)
{
Connection connection = null;
List<Blab> blabs = new ArrayList<Blab>();
String query = null;
PreparedStatement statement = null;
try
{
connection = dataSource.getConnection();
query = "SELECT blabs.id, blabs.content, users.email, users.username, bla... |
09865925-2485-434b-8d06-f7dce4e2c86d | 1 | public void mouseDragged(MouseEvent event) {
if (first == null)
return;
hover = event.getPoint();
getView().repaint();
} |
1aa66c7b-fc03-4532-a0b1-388a1bf556b6 | 4 | private FileStatus getStatus(FileInstallation installation,
Sync local) {
for (FileInstallation file : local.getFiles()) {
if (file.getLocalLocation().equalsIgnoreCase(installation
.getLocalLocation())) {
if (!file.getFile().exists()) {
return FileStatus.NOT_INSTALLED;
} else if (file.getVers... |
f663fefd-29f8-496a-9e32-ac3eb7514a42 | 6 | public void checkScore() {
if (p.calculateScore() > Integer.parseInt(highscore.split(":")[1])) {
String name = JOptionPane.showInputDialog("Highscore! Input name:");
highscore = name+ ":" + p.calculateScore();
File scoreFile = new File("highscore.dat");
if(!scoreF... |
852011f4-97a0-48a1-abd7-d7c4b8923e45 | 2 | @Override
public boolean checkPassword(String userName, String password) {
User user = userDao.checkUserName(userName);
boolean correct = false;
if (user!=null && password.equals(user.getPassword())){
correct = true;
}
return correct;
} |
9188eab0-fb34-4f47-ae2e-c148572bf216 | 2 | private String getFileName(String f) {
// get name of a file
String fname = "";
int i = f.lastIndexOf('.');
if (i > 0 && i < f.length() - 1) {
fname = f.substring(0, i);
}
return fname;
} |
36a297e7-e3e4-4941-84cb-dbab4f5aa459 | 1 | public String toString()
{
if (cidade != null)
return cidade.toString();
return id + "";
} |
f3b1fad2-c4e2-4f14-8a0f-3add16378ece | 4 | public List getMaps(GameAction gameCode) {
ArrayList list = new ArrayList();
for (int i=0; i<keyActions.length; i++) {
if (keyActions[i] == gameCode) {
list.add(getKeyName(i));
}
}
for (int i=0; i<mouseActions.length; i++) {
if (mouse... |
101f982e-6550-4d49-8bbf-7a18ef3b3b81 | 8 | public void evaluateMutationScore(boolean literalOmission, boolean literalNegation, boolean clauseOmission, boolean clauseNegation, boolean operatorAnd, boolean operatorOr, boolean print) {
createMutants(literalOmission, literalNegation, clauseOmission, clauseNegation, operatorAnd, operatorOr);
setRunni... |
600ac718-55d5-41d0-8e73-6a6517ef4eea | 0 | public List<ResPackage> getPackages() {
return this.packages;
} |
480b5254-ee8b-489b-840c-0159d9ce8448 | 8 | public boolean CreateQueue(String queueName)
throws UnspecifiedErrorException, QueueAEException, IOException, InvalidHeaderException {
final QueueCreateLogRecord record = new QueueCreateLogRecord(this, queueName);
LOGGER.log(record);
try {
server.CreateQueue(queueName);
LOGGER.log(new QueueCreate... |
c98164d4-f09d-4b66-9d81-d4cd376be6a1 | 4 | public ArrayList<Ressource> getRessourceList(int resTypeID){
ArrayList<Ressource> ressourceList = new ArrayList<>();
String SQLString = "";
PreparedStatement statement = null;
if(resTypeID==0){
SQLString = "SELECT sum(qty), Rst.Typename, Rst.Ressourcetypeid FROM ressourc... |
a0b418b6-5988-4790-9c58-2b502cddeeaf | 5 | public void novaOfertaRecursos(String nome, String contacto, OfertaRecursos.AREA_ATUACAO areaAtuacao)
throws NameNotValidException, ContactNotValidException, AreaAtuacaoNotValidException,
RemoteException, SQLException {
if (nome == null || nome.length() <= 0)
throw new NameN... |
0b0bf12a-3f0c-44a3-b38b-dce29742ce6e | 9 | static Predicate.Op getOp(String s) throws simpledb.exceptions.ParsingException {
if (s.equals("=")) return Predicate.Op.EQUALS;
if (s.equals(">")) return Predicate.Op.GREATER_THAN;
if (s.equals(">=")) return Predicate.Op.GREATER_THAN_OR_EQ;
if (s.equals("<")) return Predicate.Op.LESS_TH... |
416f5804-7d93-4368-8508-7e6b3ff7392a | 0 | public int getNumberOfTickets() {
return numberOfTickets;
} |
5ad5f70e-297e-4e86-89f7-4c32e7a69dba | 8 | @Override
protected List<String> compute() {
if (path == null || path.isEmpty() || suffix == null || suffix.isEmpty())
throw new IllegalArgumentException("传入的参数不能为空");
Path path = Paths.get(this.path);
//用来返回的搜索到的文件的具体的路径
List<String> fileList = new ArrayList<>();
... |
41a51996-720d-4012-8de6-997f8f4d11c6 | 5 | private static List<Bottle> sortBottlesByHand(List<Bottle> bottles) {
List<Bottle> sortedBottles = new ArrayList<Bottle>(bottles.size());
List<Bottle> bottlesToSort = new ArrayList<Bottle>(bottles);
while (bottlesToSort.size() > 0) {
// find smallest bottle in bootlesToSort
int smallest = 0;
Bottle smal... |
841bad95-7a6d-4858-b3ca-95f67f5356ea | 5 | private void cargar_Campos (String valor){
try{
this.vaciarCampos();
r_con.Connection();
PreparedStatement pstm = r_con.getConn().prepareStatement(
"SELECT cli_codigo,cli_nombre,cli_apellido,cli_fecha_nac,cli_cuit,loc_descripcion,cli_direccion,cli_call... |
300ab1d8-8e9f-4a1b-98cd-44bc6fb0b9ae | 8 | private Double[] getValues ()
{
ArrayList<Double> temp = new ArrayList<Double>();
int times = getOuterN();
if (times == 0)
times = 1;
// Number of repeats
for (int i = 0; i < times; i++) {
// System.out.println("Time: " + i);
// Number of patterns in each repeat
for (int j = 0; j < getPatternN();... |
f119d3ad-1e49-489a-a3ad-192d0deeae2a | 0 | private void reset() {
ball = getBall();
ball.setSpeed(6);
points = 0;
_points = 0;
player.setY(0);
repaint();
} |
caef3fc4-d06d-4c52-9999-f2b636145980 | 9 | public static int minCut(String s) {
if (s==null||s.length()==0||s.length() == 1||isPalindrome(s)) {//if is Palindrome return true directly
return 0;
} else {
if (minCutMap.get(s) != null) {
return minCutMap.get(s);
}
Integer min = null;
... |
6fe024c2-efb5-4dc9-9cec-cdd68a687068 | 5 | public boolean process (String string) {
if(!string.equals("exit")){
try{
Command c = commands.get(Integer.parseInt(string)-1).Value;
if(c.isEnabled()){
boolean result = c.run(this) != -1;
System.out.println("Please choose from the following options:");
return result;
}
else
... |
faa40709-2653-4d7d-b23f-054b4292d98c | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Abrechnung)) {
return false;
}
Abrechnung other = (Abrechnung) object;
if ((this.id == null && other.id != null... |
05bcc8cf-d3c4-4a88-927b-333e3ae0bcd4 | 7 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Cause cause = causes.get(rowIndex);
switch (columnIndex) {
case 0:
return rowIndex+1;
case 1:
return cause.getRegnum();
case 2:
... |
c3b17290-8117-45b9-aa3d-3168c223e9c9 | 1 | public String toString(){
String str = "";
if(identifiers != null)
str += identifiers.toString() + ",";
str += identifier.getNewName(false);
return str;
} |
202becf9-1d6d-48f9-9100-47dae4917439 | 8 | private static final List<String> getStatCodeExtensions(Class<?> C, final String ID)
{
final String[][] statCodeExtensions = p().statCodeExtensions;
if( statCodeExtensions == null)
return null;
final List<String> V=new Vector<String>();
String myClassName=ID;
V.add(myClassName.toUpperCase());
for(;C!=n... |
e2373804-cdee-4cf6-afa7-7a1c7347c725 | 9 | public static String doCall(String hostAddress, String path, String query) throws Exception {
boolean isSecure = false;
StringBuilder result = new StringBuilder();
int port = 80;
if (hostAddress.startsWith("http://")) {
hostAddress = hostAddress.substring(7);
... |
77806fb9-98e9-4ebe-b5fc-eec97b3e96f1 | 8 | private void findRiverOrigins() {
if (details) System.out.println("Finding river origins...");
Random rnd = new Random();
int c = 0;
int rx = 0;
int ry = 0;
do {
rx = rnd.nextInt(MyzoGEN.DIMENSION_X * chunksX);
ry = rnd.nextInt(MyzoGEN.DIMENSION_Y * chunksY);
Point p = new Point(rx, ry);
Tile t ... |
f78101af-32f2-4fbe-bb52-80554f3b5edb | 2 | public static Chevalier addChevalier(int x,int y, String nom,String type){
Chevalier c = null;
if(type.equals("joueur")){
c = new ChevalierJoueur(nom);
}
else if(type.equals("ordi")){
c = new ChevalierOrdi(nom);
}
int randomX = (int)(Math.random()*x);
int randomY = (int)(Math.random()... |
93703e63-de53-4588-b972-37a54a5eef62 | 5 | public UpgradeShop(Game g,JFrame frame) {
game=g;
upgradeFrame=frame;
initUpgrades();
addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
if(mode==1) {
for(int i=0;i<items.size();i++){
... |
9913728d-9ac9-471a-a603-3b1b0a3e8035 | 5 | public synchronized int add(Object obj, int iref) {
// Make sure the object reference is not null
if (obj == null) {
throw new NullPointerException();
}
// check whether object is already in the hashtable...
HashedRefsEntry tab[] = table;
int hash = java.lang.System.identityHashCode(obj);
int index = ... |
45261ef7-424b-449d-bc9c-1e2e753a7462 | 3 | public ArrayList<String> kategorier() {
ArrayList<String> kategorier = new ArrayList<String>();
try {
aapneForbindelse();
setning = forbindelse.prepareStatement(sqlKategori);
res = setning.executeQuery();
while (res.next()) {
if (!(res.getS... |
87e68c77-7557-4879-b62f-3d03df02cf86 | 0 | @Override
public void restoreCurrentToDefault() {cur = def;} |
b1f8653e-60b0-4f41-9651-4bc5ed88e2e2 | 2 | public static final boolean isXML(String fileName) {
for (String file : XML) {
if (file.equals(fileName)) {
return true;
}
}
return false;
} |
e955b0ca-29d0-42c7-886f-f76dd31c9595 | 2 | public int getWidth(){if(dir=='u'||dir=='d')return 84; return 112;} |
dfa1e6f2-1629-4b2c-936d-d0418946f39e | 7 | private final boolean cvc(int i) {
if (i < k0+2 || !cons(i) || cons(i-1) || !cons(i-2))
return false;
else {
int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} |
cdc24969-7fd7-4bb6-8d24-d36805a63670 | 5 | public LuaValue get(LuaValue key) {
if (jclass == null)
jclass = JavaClass.forClass(m_instance.getClass());
Field f = jclass.getField(key);
if (f != null)
try {
return CoerceJavaToLua.coerce(f.get(m_instance));
} catch (Exception e) {
throw new LuaError(e);
}
LuaValue m = jclass.getMethod(ke... |
e6f2701b-e8ff-48a1-82a5-9f425209cd44 | 7 | public String getResourceTotal()
{
int cpu_count = 0;
long memoryAvailable = 0;
long diskAvailable = 0;
try
{
List<String> regionList = ControllerEngine.gdb.getNodeList(null,null,null);
//Map<String,Map<String,String>> ahm = new HashMap<String,Map<String,String>>();
//System.out.println("Region C... |
cf266d24-e87f-4375-b5c9-ff322baba8c9 | 5 | private void createDropTypes(Composite parent) {
parent.setLayout(new RowLayout(SWT.VERTICAL));
Button textButton = new Button(parent, SWT.CHECK);
textButton.setText("Text Transfer");
textButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (Button)e.wi... |
6cd01c5d-9574-4ec2-99e9-31b756226a77 | 3 | public Location getLocation(String ip){
if(ip.startsWith("192")){// 处理内网
ip = "192";
Location location = this.locationMap.get(ip);
if(location == null){
location = createLocal();
this.locationMap.put(ip, location);
}
return location;
}
// 处理外网
Location location = this.locationM... |
2cc61f81-ec01-4243-bdd0-e9cec4ca7d8f | 7 | public SoundBuffer read()
{
if( endOfStream( GET, XXX ) )
return null;
if( module == null )
{
errorMessage( "Module null in method 'read'" );
return null;
}
// Check to make sure there is an audio format:
if( myAudioFormat == null... |
6623a93b-c595-45d1-9723-6afbcfd90f69 | 1 | public static String changeFirstCharacterCapitalized(String value,
boolean capitalized) {
String firstCharacter = value.substring(0, 1);
if (capitalized) {
return value.replaceFirst(firstCharacter,
firstCharacter.toUpperCase());
} else {
return value.replaceFirst(firstCharacter,
firstCharacter.... |
86c4f74a-46f5-49fd-ba91-18ae0bc7ca63 | 5 | @Override
public void selectGiveOption(ResourceType selectedResource, int amount) {
giveAmount.setText(Integer.toString(amount));
giveAmount.setVisible(true);
//Hide them all
givewood.setVisible(false);
givebrick.setVisible(false);
givesheep.setVisible(false);
givewheat.setVisible(false);
giveore.se... |
2f83f55f-ea10-49d5-a164-eb70f148862a | 9 | public static boolean isLR(Textile t) {
GammaGraph gamma = t.getGammaGraph();
GGraph g = t.getGGraph();
Set<GammaVertex> gammaVertices = gamma.vertexSet();
Integer matches = 0;
for(GammaVertex gammav : gammaVertices) {
for(GEdge ge : g.incomingEdgesOf(gammav.getPVHom())) {
for(GammaEdge gammae : ... |
c5db760e-02af-4bb8-8359-e976da812972 | 4 | @Override
public Optional<VariableHolder> getHighestParent()
{
if (this.parent == null)
{
Optional.absent();
}
VariableHolder next = this.parent;
if (next instanceof VariableScope)
{
VariableScope nextScope = (VariableScope) next;
... |
9a8cc8ed-5a2e-4309-a3bd-7e58ab0c0712 | 5 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/**
* Servlet ottaa vastaan Tilaus-luokan olion, joka sisältää kaikki
* tilauksen tekemiseen tarvittavat tiedot. Ennen tilauksen tallentamista
* täytyy kuitenkin tarkistaa, onko pizzeria... |
efd5dcdb-92cd-4afc-963d-12a453f1dbb9 | 4 | static boolean areInSameRuntimeClassLoader(Class type1, Class type2) {
if (type1.getPackage()!=type2.getPackage()) {
return false;
}
ClassLoader loader1 = type1.getClassLoader();
ClassLoader loader2 = type2.getClassLoader();
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
if (loader1... |
3da6b95c-55a8-499d-8c96-990c8d3ca2ca | 7 | public static HashMap<Integer, Double> PMICheck(List<FeatureInstance> list) {
// count how may times y==true
// for each feature x count howmany times x happned whne y was true
// count probability of y,
// count the probbility for each y, x
int yTrueIndex = 0;
HashMap<Integer, Double> xProbIndex = new Has... |
aa2454f6-c1af-42f4-aff4-5978906e0442 | 7 | public static NetworkMessage parseMessage(byte[] data) {
switch (data[0]) {
case STRING_MESSAGE:
return new StringMessage(data);
case IDENTIFICATION_MESSAGE:
return new IdentificationMessage(data);
case ARRIVAL_CONFIRMED_MESSAGE:
return new ArrivalConfirmedMessage(data);
case GAME_MESSAGE:
... |
66dc79f9-fbff-4383-a577-23c8dc6c0bcc | 1 | private void desconectar() {
try {
salida.println("/quit");
conectado = false;
socket.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
} |
d83d437c-2556-4035-bdb2-2a9a7bb813c6 | 6 | public static StringBlock read(IntReader reader) throws IOException {
ReadUtil.readCheckType(reader,CHUNK_TYPE);
int chunkSize=reader.readInt();
int stringCount=reader.readInt();
int styleOffsetCount=reader.readInt();
/*?*/reader.readInt();
int stringsOffset=reader.readInt();
int stylesOffset=reader.readI... |
8b0ee18b-baa3-4786-aea3-247967fcfc42 | 7 | public boolean update(float time)
{
float speed = 100; // how far is next square away
float velocityX = ((Gdx.input.isKeyPressed(Keys.RIGHT)) ? 1 : 0) * speed - ((Gdx.input.isKeyPressed(Keys.LEFT)) ? 1 : 0) * speed;
float velocityY = ((Gdx.input.isKeyPressed(Keys.UP)) ? 1 : 0) * speed - ((Gdx.input.isKeyPressed(... |
d459f4b5-e330-4228-9eb0-971e1713157e | 0 | public void setAuther(String auther) {
this.auther = auther;
} |
5583cc62-8da1-442a-8843-4c342dbdf1c7 | 7 | private void changeCreditStatus(int creditStatus) {
final int indexColumnName = 0;
final int indexColumnStatus = 3;
int selectedRowIndex = creditTable.getSelectedRow();
if (creditStatus == -1) {
String status = String.valueOf(creditTable.getValueAt(sele... |
cce00ec7-a82e-4045-9e90-2cac37500661 | 0 | public int compare(Object o1, Object o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
return s2.compareTo(s1);
} |
107618cc-433b-4ef9-a3d6-25d7343fe86c | 3 | @Override
public void move(Excel start, Excel finish) {
// TODO Auto-generated method stub
for(int i=0;i<allex.size();i++)
{
if (start.getX() == allex.get(i).getX() && start.getY() == allex.get(i).getY())
{
allex.remove(i);
allex.add(i, finish);
setColoredExes();
break;
}
}
} |
fefd57fc-e5a9-4a8e-b26a-d2c7f18d8b49 | 6 | private Rio500 getRio ()
{
if (rio == null) {
try {
rio = new Rio500 (dev);
rio.start ();
folders = rio.getFolders (false);
if (rio.hasExternalMemory ()) {
FolderEntry external [] = rio.getFolders (true);
if (external.length != 0) {
FolderEntry temp [] =
new FolderEntry [folder... |
20ae2842-d4a2-4623-b179-c2225104fd8c | 1 | public static void CreateWindow(int width, int height, String title)
{
Display.setTitle(title);
try
{
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
Keyboard.create();
Mouse.create();
}
catch (LWJGLException e)
{
e.printStackTrace();
}
} |
0482d488-ed23-44e4-b016-9179154eeeab | 9 | private boolean putInMap(String companyName, String year, String month,
String value) {
if (companyName == null || year == null || month == null
|| value == null) {
hasJunkData = true;
return false;
}
Double val = null;
try {
val = Double.parseDouble(value);
} catch (NumberFormatException e)... |
b2d486aa-f12b-4bb1-a037-663a4a13a7b3 | 6 | public static int getIntegerSignedValue(String binaryString, int bitNumber){
int x = 0;
binaryString = extendToMaxBitsSigned(binaryString, bitNumber);
boolean isNegative = (binaryString.length() == bitNumber && binaryString.charAt(0) == '1') ? true : false;
if(isNegative){
for(int i = 0; i < 32 - bitNumber; ... |
e1b38741-75f3-4565-a5fb-ecff5404ce54 | 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... |
6bc7f7b1-6616-48e3-9714-920c82ba8734 | 1 | public void operateMatrix(Matrix[]... srcs) {
// init Matrix
Matrix[] zeroMat = srcs[0];
super.mat[0].setMatrix(0, super.matHeight-1, 0, super.matWidth-1, zeroMat[0]);
if (codeCbCr) {
super.mat[1].setMatrix(0, super.matHeightC-1, 0, super.matWidthC-1, zero... |
ff851383-4dc5-485a-9b5e-5bdc9b7bc194 | 8 | final public ASTStart Start() throws ParseException {
/* @bgen(jjtree) Start */
ASTStart jjtn000 = new ASTStart(JJTSTART);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
if (jj_2_1(1)) {
Expression();
jj_consume_token(0);
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
... |
1391bcc5-60ba-45f0-90c5-6d434a8642df | 3 | private boolean inBetweenMod(int a, int b, int x, int n) {
if(b < a) b += n;
if(x < a) x += n;
return a <= x && x <= b;
} |
d762ee22-afca-4aa5-845e-49b8cb0e18f0 | 1 | public static BufferedImage loadSprite(String spriteFilename) {
try {
return ImageIO.read(new File("Resources/Sprites/" + spriteFilename));
} catch (IOException e) {
System.out.println("File not found");
e.printStackTrace();
}
return null;
} |
762d7f76-1b5e-445b-9422-6b8dad27a940 | 1 | public int retrieveId(String mess) {
try {
JSONObject obj = new JSONObject(mess);
return obj.getInt("PacketID");
} catch (JSONException e) {
}
return 0;
} |
df0f1ef6-d731-4e24-a7a1-a6f56b8c4cfb | 9 | public static void loadFont(String address) {
int wid_default = 9, hei_default = 10;
int sum_x = 0, y = 0;
int width;
try {
// finding
FileReader ent = new FileReader(address);
BufferedReader buffered = new BufferedReader(ent);
// reading
String in = "";
String a[];
while( (in = ... |
be22701f-c73e-4939-a311-73ec2f600ea3 | 1 | public void actionPerformed(ActionEvent e) {
if (mapChange == 4) {
fountainChange = fountainChange + velFountain;
}
repaint();
} |
258d4f71-17de-417c-ac90-c618e1d47eb2 | 7 | protected static String grindString(String s0) {
// strip the enclosing quotes and handle backslash conversions.
// (Matlab backslash conversions defined by 'help sprintf').
String s1 = s0.substring(1, s0.length()-1);
StringBuffer buf = new StringBuffer();
for(int i = 0; i < s1.length(); i++) {
... |
eee76443-7c84-49bf-ae2c-9273e1bcd89c | 1 | private void generateHardwareSetAlternativesEP() {
for (HardwareSet hws : project.getHardwareSets())
hws.generateCheapestHardwareSetAlternatives();
} |
a638e0ef-8a8c-4bd8-98eb-df9b1d6ae77a | 1 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HMWord word = (HMWord) request.getSession().getAttribute("word");
String letter = request.getParameter("letter");
word.checkGuess(letter.charAt(0));
request.getSession().setAttribute("word", ... |
d09296fe-12c9-498a-9d7c-9ad12f0bb9fa | 7 | protected StringBuffer colorwebifyOnly(StringBuffer s)
{
if(s==null)
return null;
int i=0;
final String[] lookup=CMLib.color().standardHTMLlookups();
while(i<s.length())
{
if(s.charAt(i)=='^')
{
if(i<(s.length()-1))
{
final char c=s.charAt(i+1);
//TODO: handle ~ and # here?
fi... |
44436a22-f9cd-4373-809a-c09752232787 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof MatchResult)) {
return false;
}
MatchResult other = (MatchResult) object;
if ((this.id == null && other.id != n... |
3da42e98-c632-40cb-94be-c99bfa5f3add | 8 | public String convert(String s, int nRows) {
if (nRows == 1) {
return s;
} else {
// calculate some params
int matrixCnt = 2 * nRows - 2;
int nMatrix = s.length() / matrixCnt + (s.length() % matrixCnt == 0 ? 0 : 1);
// initialize result arrays
... |
0340fa41-d727-43f1-968e-c5b7449cd6fd | 5 | void notifyRefreshFiles(File[] files) {
if (files != null && files.length == 0) return;
if ((deferredRefreshRequested) && (deferredRefreshFiles != null) && (files != null)) {
// merge requests
File[] newRequest = new File[deferredRefreshFiles.length + files.length];
System.arraycopy(deferredRefreshFiles, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.